Ext.dd.DD=function(id,sGroup,config){
	if(id){
		this.init(id,sGroup,config);
	}};
Ext.extend(Ext.dd.DD,Ext.dd.DragDrop,{
	scroll:true,
	autoOffset:function(iPageX,iPageY){
		var x=iPageX-this.startPageX;
		var y=iPageY-this.startPageY;
		this.setDelta(x,y);
	},
	setDelta:function(iDeltaX,iDeltaY){
		this.deltaX=iDeltaX;
		this.deltaY=iDeltaY;
	},
	setDragElPos:function(iPageX,iPageY){
		var el=this.getDragEl();
		this.alignElWithMouse(el,iPageX,iPageY);
	},
	alignElWithMouse:function(el,iPageX,iPageY){
		var oCoord=this.getTargetCoord(iPageX,iPageY);
		var fly=el.dom?el:Ext.fly(el,'_dd');
		if(!this.deltaSetXY){
			var aCoord=[oCoord.x,oCoord.y];
			fly.setXY(aCoord);
			var newLeft=fly.getLeft(true);
			var newTop=fly.getTop(true);
			this.deltaSetXY=[newLeft-oCoord.x,newTop-oCoord.y];
		}else{
			fly.setLeftTop(oCoord.x+this.deltaSetXY[0],oCoord.y+this.deltaSetXY[1]);
		}
		this.cachePosition(oCoord.x,oCoord.y);
		this.autoScroll(oCoord.x,oCoord.y,el.offsetHeight,el.offsetWidth);
		return oCoord;
	},
	cachePosition:function(iPageX,iPageY){
		if(iPageX){
			this.lastPageX=iPageX;
			this.lastPageY=iPageY;
		}else{
			var aCoord=Ext.lib.Dom.getXY(this.getEl());
			this.lastPageX=aCoord[0];
			this.lastPageY=aCoord[1];
		}
	},
	autoScroll:function(x,y,h,w){
		if(this.scroll){
			var clientH=Ext.lib.Dom.getViewHeight();
			var clientW=Ext.lib.Dom.getViewWidth();
			var st=this.DDM.getScrollTop();
			var sl=this.DDM.getScrollLeft();
			var bot=h+y;
			var right=w+x;
			var toBot=(clientH+st-y-this.deltaY);
			var toRight=(clientW+sl-x-this.deltaX);
			var thresh=40;
			var scrAmt=(document.all)?80:30;
			if(bot>clientH&&toBot<thresh){
				window.scrollTo(sl,st+scrAmt);
			}
			if(y<st&&st>0&&y-st<thresh){
				window.scrollTo(sl,st-scrAmt);
			}
			if(right>clientW&&toRight<thresh){
				window.scrollTo(sl+scrAmt,st);
			}
			if(x<sl&&sl>0&&x-sl<thresh){
				window.scrollTo(sl-scrAmt,st);
			}
		}
	},
	getTargetCoord:function(iPageX,iPageY){
		var x=iPageX-this.deltaX;
		var y=iPageY-this.deltaY;
		if(this.constrainX){
			if(x<this.minX){x=this.minX;}
			if(x>this.maxX){x=this.maxX;}
		}
		if(this.constrainY){
			if(y<this.minY){y=this.minY;}
			if(y>this.maxY){y=this.maxY;}
		}
		x=this.getTick(x,this.xTicks);
		y=this.getTick(y,this.yTicks);
		return{x:x,y:y};
	},
	applyConfig:function(){
		Ext.dd.DD.superclass.applyConfig.call(this);
		this.scroll=(this.config.scroll!==false);
	},
	b4MouseDown:function(e){
		this.autoOffset(e.getPageX(),
							e.getPageY());
	},
	b4Drag:function(e){
		this.setDragElPos(e.getPageX(),
							e.getPageY());
	},
	toString:function(){
		return("DD "+this.id);
	}
	});
Ext.dd.DDProxy=function(id,sGroup,config){
	if(id){
		this.init(id,sGroup,config);
		this.initFrame();
	}};
Ext.dd.DDProxy.dragElId="ygddfdiv";
Ext.extend(Ext.dd.DDProxy,Ext.dd.DD,{
	resizeFrame:true,
	centerFrame:false,
	createFrame:function(){
		var self=this;
		var body=document.body;
		if(!body||!body.firstChild){
			setTimeout(function(){self.createFrame();},50);
			return;
		}
		var div=this.getDragEl();
		if(!div){
			div	=document.createElement("div");
			div.id=this.dragElId;
			var s=div.style;
			s.position="absolute";
			s.visibility="hidden";
			s.cursor	="move";
			s.border	="2px solid #aaa";
			s.zIndex	=999;
			body.insertBefore(div,body.firstChild);
		}
	},
	initFrame:function(){
		this.createFrame();
	},
	applyConfig:function(){
		Ext.dd.DDProxy.superclass.applyConfig.call(this);
		this.resizeFrame=(this.config.resizeFrame!==false);
		this.centerFrame=(this.config.centerFrame);
		this.setDragElId(this.config.dragElId||Ext.dd.DDProxy.dragElId);
	},
	showFrame:function(iPageX,iPageY){
		var el=this.getEl();
		var dragEl=this.getDragEl();
		var s=dragEl.style;
		this._resizeProxy();
		if(this.centerFrame){
			this.setDelta(Math.round(parseInt(s.width,10)/2),
						 Math.round(parseInt(s.height,10)/2));
		}
		this.setDragElPos(iPageX,iPageY);
		Ext.fly(dragEl).show();
	},
	_resizeProxy:function(){
		if(this.resizeFrame){
			var el=this.getEl();
			Ext.fly(this.getDragEl()).setSize(el.offsetWidth,el.offsetHeight);
		}
	},
	b4MouseDown:function(e){
		var x=e.getPageX();
		var y=e.getPageY();
		this.autoOffset(x,y);
		this.setDragElPos(x,y);
	},
	b4StartDrag:function(x,y){
		this.showFrame(x,y);
	},
	b4EndDrag:function(e){
		Ext.fly(this.getDragEl()).hide();
	},
	endDrag:function(e){
		var lel=this.getEl();
		var del=this.getDragEl();
		del.style.visibility="";
		this.beforeMove();
		lel.style.visibility="hidden";
		Ext.dd.DDM.moveToEl(lel,del);
		del.style.visibility="hidden";
		lel.style.visibility="";
		this.afterDrag();
	},
	beforeMove:function(){
	},
	afterDrag:function(){
	},
	toString:function(){
		return("DDProxy "+this.id);
	}});
Ext.dd.DDTarget=function(id,sGroup,config){
	if(id){
		this.initTarget(id,sGroup,config);
	}};
Ext.extend(Ext.dd.DDTarget,Ext.dd.DragDrop,{
	toString:function(){
		return("DDTarget "+this.id);
	}});
Ext.dd.DragTracker=function(config){
	Ext.apply(this,config);
	this.addEvents(
		'mousedown',
		'mouseup',
		'mousemove',
		'dragstart',
		'dragend',
		'drag'
	);
	this.dragRegion=new Ext.lib.Region(0,0,0,0);
	if(this.el){
		this.initEl(this.el);
	}}
Ext.extend(Ext.dd.DragTracker,Ext.util.Observable,{
	active:false,
	tolerance:5,
	autoStart:false,
	initEl:function(el){
		this.el=Ext.get(el);
		el.on('mousedown',this.onMouseDown,this,
				this.delegate?{delegate:this.delegate}:undefined);
	},
	destroy:function(){
		this.el.un('mousedown',this.onMouseDown,this);
	},
	onMouseDown:function(e,target){
		if(this.fireEvent('mousedown',this,e)!==false&&this.onBeforeStart(e)!==false){
			this.startXY=this.lastXY=e.getXY();
			this.dragTarget=this.delegate?target:this.el.dom;
			if(this.preventDefault!==false){
				e.preventDefault();
			}
			var doc=Ext.getDoc();
			doc.on('mouseup',this.onMouseUp,this);
			doc.on('mousemove',this.onMouseMove,this);
			doc.on('selectstart',this.stopSelect,this);
			if(this.autoStart){
				this.timer=this.triggerStart.defer(this.autoStart===true?1000:this.autoStart,this);
			}
		}
	},
	onMouseMove:function(e,target){
		if(this.active&&Ext.isIE&&!e.browserEvent.button){
			e.preventDefault();
			this.onMouseUp(e);
			return;
		}
		e.preventDefault();
		var xy=e.getXY(),s=this.startXY;
		this.lastXY=xy;
		if(!this.active){
			if(Math.abs(s[0]-xy[0])>this.tolerance||Math.abs(s[1]-xy[1])>this.tolerance){
				this.triggerStart();
			}else{
				return;
			}
		}
		this.fireEvent('mousemove',this,e);
		this.onDrag(e);
		this.fireEvent('drag',this,e);
	},
	onMouseUp:function(e){
		var doc=Ext.getDoc();
		doc.un('mousemove',this.onMouseMove,this);
		doc.un('mouseup',this.onMouseUp,this);
		doc.un('selectstart',this.stopSelect,this);
		e.preventDefault();
		this.clearStart();
		var wasActive=this.active;
		this.active=false;
		delete this.elRegion;
		this.fireEvent('mouseup',this,e);
		if(wasActive){
			this.onEnd(e);
			this.fireEvent('dragend',this,e);
		}
	},
	triggerStart:function(isTimer){
		this.clearStart();
		this.active=true;
		this.onStart(this.startXY);
		this.fireEvent('dragstart',this,this.startXY);
	},
	clearStart:function(){
		if(this.timer){
			clearTimeout(this.timer);
			delete this.timer;
		}
	},
	stopSelect:function(e){
		e.stopEvent();
		return false;
	},
	onBeforeStart:function(e){
	},
	onStart:function(xy){
	},
	onDrag:function(e){
	},
	onEnd:function(e){
	},
	getDragTarget:function(){
		return this.dragTarget;
	},
	getDragCt:function(){
		return this.el;
	},
	getXY:function(constrain){
		return constrain?
			 this.constrainModes[constrain].call(this,this.lastXY):this.lastXY;
	},
	getOffset:function(constrain){
		var xy=this.getXY(constrain);
		var s=this.startXY;
		return[s[0]-xy[0],s[1]-xy[1]];
	},
	constrainModes:{
		'point':function(xy){
			if(!this.elRegion){
				this.elRegion=this.getDragCt().getRegion();
			}
			var dr=this.dragRegion;
			dr.left=xy[0];
			dr.top=xy[1];
			dr.right=xy[0];
			dr.bottom=xy[1];
			dr.constrainTo(this.elRegion);
			return[dr.left,dr.top];
		}
	}});
Ext.dd.ScrollManager=function(){
	var ddm=Ext.dd.DragDropMgr;
	var els={};
	var dragEl=null;
	var proc={};
	var onStop=function(e){
		dragEl=null;
		clearProc();
	};
	var triggerRefresh=function(){
		if(ddm.dragCurrent){
			 ddm.refreshCache(ddm.dragCurrent.groups);
		}
	};
	var doScroll=function(){
		if(ddm.dragCurrent){
			var dds=Ext.dd.ScrollManager;
			var inc=proc.el.ddScrollConfig?
					 proc.el.ddScrollConfig.increment:dds.increment;
			if(!dds.animate){
				if(proc.el.scroll(proc.dir,inc)){
					triggerRefresh();
				}
			}else{
				proc.el.scroll(proc.dir,inc,true,dds.animDuration,triggerRefresh);
			}
		}
	};
	var clearProc=function(){
		if(proc.id){
			clearInterval(proc.id);
		}
		proc.id=0;
		proc.el=null;
		proc.dir="";
	};
	var startProc=function(el,dir){
		clearProc();
		proc.el=el;
		proc.dir=dir;
		var freq=(el.ddScrollConfig&&el.ddScrollConfig.frequency)?
				el.ddScrollConfig.frequency:Ext.dd.ScrollManager.frequency;
		proc.id=setInterval(doScroll,freq);
	};
	var onFire=function(e,isDrop){
		if(isDrop||!ddm.dragCurrent){return;}
		var dds=Ext.dd.ScrollManager;
		if(!dragEl||dragEl!=ddm.dragCurrent){
			dragEl=ddm.dragCurrent;
			dds.refreshCache();
		}
		var xy=Ext.lib.Event.getXY(e);
		var pt=new Ext.lib.Point(xy[0],xy[1]);
		for(var id in els){
			var el=els[id],r=el._region;
			var c=el.ddScrollConfig?el.ddScrollConfig:dds;
			if(r&&r.contains(pt)&&el.isScrollable()){
				if(r.bottom-pt.y<=c.vthresh){
					if(proc.el!=el){
						startProc(el,"down");
					}
					return;
				}else if(r.right-pt.x<=c.hthresh){
					if(proc.el!=el){
						startProc(el,"left");
					}
					return;
				}else if(pt.y-r.top<=c.vthresh){
					if(proc.el!=el){
						startProc(el,"up");
					}
					return;
				}else if(pt.x-r.left<=c.hthresh){
					if(proc.el!=el){
						startProc(el,"right");
					}
					return;
				}
			}
		}
		clearProc();
	};
	ddm.fireEvents=ddm.fireEvents.createSequence(onFire,ddm);
	ddm.stopDrag=ddm.stopDrag.createSequence(onStop,ddm);
	return{
		register:function(el){
			if(Ext.isArray(el)){
				for(var i=0,len=el.length;i<len;i++){
					this.register(el[i]);
				}
			}else{
				el=Ext.get(el);
				els[el.id]=el;
			}
		},
		unregister:function(el){
			if(Ext.isArray(el)){
				for(var i=0,len=el.length;i<len;i++){
					this.unregister(el[i]);
				}
			}else{
				el=Ext.get(el);
				delete els[el.id];
			}
		},
		vthresh:25,
		hthresh:25,
		increment:100,
		frequency:500,
		animate:true,
		animDuration:.4,
		refreshCache:function(){
			for(var id in els){
				if(typeof els[id]=='object'){
					els[id]._region=els[id].getRegion();
				}
			}
		}
	};}();
Ext.dd.Registry=function(){
	var elements={};
	var handles={};
	var autoIdSeed=0;
	var getId=function(el,autogen){
		if(typeof el=="string"){
			return el;
		}
		var id=el.id;
		if(!id&&autogen!==false){
			id="extdd-"+(++autoIdSeed);
			el.id=id;
		}
		return id;
	};
	return{
		register:function(el,data){
			data=data||{};
			if(typeof el=="string"){
				el=document.getElementById(el);
			}
			data.ddel=el;
			elements[getId(el)]=data;
			if(data.isHandle!==false){
				handles[data.ddel.id]=data;
			}
			if(data.handles){
				var hs=data.handles;
				for(var i=0,len=hs.length;i<len;i++){
					handles[getId(hs[i])]=data;
				}
			}
		},
		unregister:function(el){
			var id=getId(el,false);
			var data=elements[id];
			if(data){
				delete elements[id];
				if(data.handles){
					var hs=data.handles;
					for(var i=0,len=hs.length;i<len;i++){
						delete handles[getId(hs[i],false)];
					}
				}
			}
		},
		getHandle:function(id){
			if(typeof id!="string"){
				id=id.id;
			}
			return handles[id];
		},
		getHandleFromEvent:function(e){
			var t=Ext.lib.Event.getTarget(e);
			return t?handles[t.id]:null;
		},
		getTarget:function(id){
			if(typeof id!="string"){
				id=id.id;
			}
			return elements[id];
		},
		getTargetFromEvent:function(e){
			var t=Ext.lib.Event.getTarget(e);
			return t?elements[t.id]||handles[t.id]:null;
		}
	};}();
Ext.dd.StatusProxy=function(config){
	Ext.apply(this,config);
	this.id=this.id||Ext.id();
	this.el=new Ext.Layer({
		dh:{
			id:this.id,tag:"div",cls:"x-dd-drag-proxy "+this.dropNotAllowed,children:[
				{tag:"div",cls:"x-dd-drop-icon"},
				{tag:"div",cls:"x-dd-drag-ghost"}
			]
		},
		shadow:!config||config.shadow!==false
	});
	this.ghost=Ext.get(this.el.dom.childNodes[1]);
	this.dropStatus=this.dropNotAllowed;};
Ext.dd.StatusProxy.prototype={
	dropAllowed:"x-dd-drop-ok",
	dropNotAllowed:"x-dd-drop-nodrop",
	setStatus:function(cssClass){
		cssClass=cssClass||this.dropNotAllowed;
		if(this.dropStatus!=cssClass){
			this.el.replaceClass(this.dropStatus,cssClass);
			this.dropStatus=cssClass;
		}
	},
	reset:function(clearGhost){
		this.el.dom.className="x-dd-drag-proxy "+this.dropNotAllowed;
		this.dropStatus=this.dropNotAllowed;
		if(clearGhost){
			this.ghost.update("");
		}
	},
	update:function(html){
		if(typeof html=="string"){
			this.ghost.update(html);
		}else{
			this.ghost.update("");
			html.style.margin="0";
			this.ghost.dom.appendChild(html);
		}
		var el=this.ghost.dom.firstChild;
		if(el){
			Ext.fly(el).setStyle('float','none');
		}
	},
	getEl:function(){
		return this.el;
	},
	getGhost:function(){
		return this.ghost;
	},
	hide:function(clear){
		this.el.hide();
		if(clear){
			this.reset(true);
		}
	},
	stop:function(){
		if(this.anim&&this.anim.isAnimated&&this.anim.isAnimated()){
			this.anim.stop();
		}
	},
	show:function(){
		this.el.show();
	},
	sync:function(){
		this.el.sync();
	},
	repair:function(xy,callback,scope){
		this.callback=callback;
		this.scope=scope;
		if(xy&&this.animRepair!==false){
			this.el.addClass("x-dd-drag-repair");
			this.el.hideUnders(true);
			this.anim=this.el.shift({
				duration:this.repairDuration||.5,
				easing:'easeOut',
				xy:xy,
				stopFx:true,
				callback:this.afterRepair,
				scope:this
			});
		}else{
			this.afterRepair();
		}
	},
	afterRepair:function(){
		this.hide(true);
		if(typeof this.callback=="function"){
			this.callback.call(this.scope||this);
		}
		this.callback=null;
		this.scope=null;
	}};
Ext.dd.DragSource=function(el,config){
	this.el=Ext.get(el);
	if(!this.dragData){
		this.dragData={};
	}
	Ext.apply(this,config);
	if(!this.proxy){
		this.proxy=new Ext.dd.StatusProxy();
	}
	Ext.dd.DragSource.superclass.constructor.call(this,this.el.dom,this.ddGroup||this.group,
		{dragElId:this.proxy.id,resizeFrame:false,isTarget:false,scroll:this.scroll===true});
	this.dragging=false;};
Ext.extend(Ext.dd.DragSource,Ext.dd.DDProxy,{
	dropAllowed:"x-dd-drop-ok",
	dropNotAllowed:"x-dd-drop-nodrop",
	getDragData:function(e){
		return this.dragData;
	},
	onDragEnter:function(e,id){
		var target=Ext.dd.DragDropMgr.getDDById(id);
		this.cachedTarget=target;
		if(this.beforeDragEnter(target,e,id)!==false){
			if(target.isNotifyTarget){
				var status=target.notifyEnter(this,e,this.dragData);
				this.proxy.setStatus(status);
			}else{
				this.proxy.setStatus(this.dropAllowed);
			}
			if(this.afterDragEnter){
				this.afterDragEnter(target,e,id);
			}
		}
	},
	beforeDragEnter:function(target,e,id){
		return true;
	},
	alignElWithMouse:function(){
		Ext.dd.DragSource.superclass.alignElWithMouse.apply(this,arguments);
		this.proxy.sync();
	},
	onDragOver:function(e,id){
		var target=this.cachedTarget||Ext.dd.DragDropMgr.getDDById(id);
		if(this.beforeDragOver(target,e,id)!==false){
			if(target.isNotifyTarget){
				var status=target.notifyOver(this,e,this.dragData);
				this.proxy.setStatus(status);
			}
			if(this.afterDragOver){
				this.afterDragOver(target,e,id);
			}
		}
	},
	beforeDragOver:function(target,e,id){
		return true;
	},
	onDragOut:function(e,id){
		var target=this.cachedTarget||Ext.dd.DragDropMgr.getDDById(id);
		if(this.beforeDragOut(target,e,id)!==false){
			if(target.isNotifyTarget){
				target.notifyOut(this,e,this.dragData);
			}
			this.proxy.reset();
			if(this.afterDragOut){
				this.afterDragOut(target,e,id);
			}
		}
		this.cachedTarget=null;
	},
	beforeDragOut:function(target,e,id){
		return true;
	},
	onDragDrop:function(e,id){
		var target=this.cachedTarget||Ext.dd.DragDropMgr.getDDById(id);
		if(this.beforeDragDrop(target,e,id)!==false){
			if(target.isNotifyTarget){
				if(target.notifyDrop(this,e,this.dragData)){
					this.onValidDrop(target,e,id);
				}else{
					this.onInvalidDrop(target,e,id);
				}
			}else{
				this.onValidDrop(target,e,id);
			}
			if(this.afterDragDrop){
				this.afterDragDrop(target,e,id);
			}
		}
		delete this.cachedTarget;
	},
	beforeDragDrop:function(target,e,id){
		return true;
	},
	onValidDrop:function(target,e,id){
		this.hideProxy();
		if(this.afterValidDrop){
			this.afterValidDrop(target,e,id);
		}
	},
	getRepairXY:function(e,data){
		return this.el.getXY();
	},
	onInvalidDrop:function(target,e,id){
		this.beforeInvalidDrop(target,e,id);
		if(this.cachedTarget){
			if(this.cachedTarget.isNotifyTarget){
				this.cachedTarget.notifyOut(this,e,this.dragData);
			}
			this.cacheTarget=null;
		}
		this.proxy.repair(this.getRepairXY(e,this.dragData),this.afterRepair,this);
		if(this.afterInvalidDrop){
			this.afterInvalidDrop(e,id);
		}
	},
	afterRepair:function(){
		if(Ext.enableFx){
			this.el.highlight(this.hlColor||"c3daf9");
		}
		this.dragging=false;
	},
	beforeInvalidDrop:function(target,e,id){
		return true;
	},
	handleMouseDown:function(e){
		if(this.dragging){
			return;
		}
		var data=this.getDragData(e);
		if(data&&this.onBeforeDrag(data,e)!==false){
			this.dragData=data;
			this.proxy.stop();
			Ext.dd.DragSource.superclass.handleMouseDown.apply(this,arguments);
		}
	},
	onBeforeDrag:function(data,e){
		return true;
	},
	onStartDrag:Ext.emptyFn,
	startDrag:function(x,y){
		this.proxy.reset();
		this.dragging=true;
		this.proxy.update("");
		this.onInitDrag(x,y);
		this.proxy.show();
	},
	onInitDrag:function(x,y){
		var clone=this.el.dom.cloneNode(true);
		clone.id=Ext.id();
		this.proxy.update(clone);
		this.onStartDrag(x,y);
		return true;
	},
	getProxy:function(){
		return this.proxy;
	},
	hideProxy:function(){
		this.proxy.hide();
		this.proxy.reset(true);
		this.dragging=false;
	},
	triggerCacheRefresh:function(){
		Ext.dd.DDM.refreshCache(this.groups);
	},
	b4EndDrag:function(e){
	},
	endDrag:function(e){
		this.onEndDrag(this.dragData,e);
	},
	onEndDrag:function(data,e){
	},
	autoOffset:function(x,y){
		this.setDelta(-12,-20);
	}});
Ext.dd.DropTarget=function(el,config){
	this.el=Ext.get(el);
	Ext.apply(this,config);
	if(this.containerScroll){
		Ext.dd.ScrollManager.register(this.el);
	}
	Ext.dd.DropTarget.superclass.constructor.call(this,this.el.dom,this.ddGroup||this.group,
		{isTarget:true});};
Ext.extend(Ext.dd.DropTarget,Ext.dd.DDTarget,{
	dropAllowed:"x-dd-drop-ok",
	dropNotAllowed:"x-dd-drop-nodrop",
	isTarget:true,
	isNotifyTarget:true,
	notifyEnter:function(dd,e,data){
		if(this.overClass){
			this.el.addClass(this.overClass);
		}
		return this.dropAllowed;
	},
	notifyOver:function(dd,e,data){
		return this.dropAllowed;
	},
	notifyOut:function(dd,e,data){
		if(this.overClass){
			this.el.removeClass(this.overClass);
		}
	},
	notifyDrop:function(dd,e,data){
		return false;
	}});
Ext.dd.DragZone=function(el,config){
	Ext.dd.DragZone.superclass.constructor.call(this,el,config);
	if(this.containerScroll){
		Ext.dd.ScrollManager.register(this.el);
	}};
Ext.extend(Ext.dd.DragZone,Ext.dd.DragSource,{
	getDragData:function(e){
		return Ext.dd.Registry.getHandleFromEvent(e);
	},
	onInitDrag:function(x,y){
		this.proxy.update(this.dragData.ddel.cloneNode(true));
		this.onStartDrag(x,y);
		return true;
	},
	afterRepair:function(){
		if(Ext.enableFx){
			Ext.Element.fly(this.dragData.ddel).highlight(this.hlColor||"c3daf9");
		}
		this.dragging=false;
	},
	getRepairXY:function(e){
		return Ext.Element.fly(this.dragData.ddel).getXY();
	}});
Ext.dd.DropZone=function(el,config){
	Ext.dd.DropZone.superclass.constructor.call(this,el,config);};
Ext.extend(Ext.dd.DropZone,Ext.dd.DropTarget,{
	getTargetFromEvent:function(e){
		return Ext.dd.Registry.getTargetFromEvent(e);
	},
	onNodeEnter:function(n,dd,e,data){
	},
	onNodeOver:function(n,dd,e,data){
		return this.dropAllowed;
	},
	onNodeOut:function(n,dd,e,data){
	},
	onNodeDrop:function(n,dd,e,data){
		return false;
	},
	onContainerOver:function(dd,e,data){
		return this.dropNotAllowed;
	},
	onContainerDrop:function(dd,e,data){
		return false;
	},
	notifyEnter:function(dd,e,data){
		return this.dropNotAllowed;
	},
	notifyOver:function(dd,e,data){
		var n=this.getTargetFromEvent(e);
		if(!n){
			if(this.lastOverNode){
				this.onNodeOut(this.lastOverNode,dd,e,data);
				this.lastOverNode=null;
			}
			return this.onContainerOver(dd,e,data);
		}
		if(this.lastOverNode!=n){
			if(this.lastOverNode){
				this.onNodeOut(this.lastOverNode,dd,e,data);
			}
			this.onNodeEnter(n,dd,e,data);
			this.lastOverNode=n;
		}
		return this.onNodeOver(n,dd,e,data);
	},
	notifyOut:function(dd,e,data){
		if(this.lastOverNode){
			this.onNodeOut(this.lastOverNode,dd,e,data);
			this.lastOverNode=null;
		}
	},
	notifyDrop:function(dd,e,data){
		if(this.lastOverNode){
			this.onNodeOut(this.lastOverNode,dd,e,data);
			this.lastOverNode=null;
		}
		var n=this.getTargetFromEvent(e);
		return n?
			this.onNodeDrop(n,dd,e,data):
			this.onContainerDrop(dd,e,data);
	},
	triggerCacheRefresh:function(){
		Ext.dd.DDM.refreshCache(this.groups);
	}});
Ext.Element.addMethods({
	initDD:function(group,config,overrides){
		var dd=new Ext.dd.DD(Ext.id(this.dom),group,config);
		return Ext.apply(dd,overrides);
	},
	initDDProxy:function(group,config,overrides){
		var dd=new Ext.dd.DDProxy(Ext.id(this.dom),group,config);
		return Ext.apply(dd,overrides);
	},
	initDDTarget:function(group,config,overrides){
		var dd=new Ext.dd.DDTarget(Ext.id(this.dom),group,config);
		return Ext.apply(dd,overrides);
	}});
Ext.data.Api=(function(){
	var validActions={};
	return{
		actions:{
			create:'create',
			read	:'read',
			update:'update',
			destroy:'destroy'
		},
		restActions:{
			create:'POST',
			read	:'GET',
			update:'PUT',
			destroy:'DELETE'
		},
		isAction:function(action){
			return(Ext.data.Api.actions[action])?true:false;
		},
		getVerb:function(name){
			if(validActions[name]){
				return validActions[name];
			}
			for(var verb in this.actions){
				if(this.actions[verb]===name){
					validActions[name]=verb;
					break;
				}
			}
			return(validActions[name]!==undefined)?validActions[name]:null;
		},
		isValid:function(api){
			var invalid=[];
			var crud=this.actions;
			for(var action in api){
				if(!(action in crud)){
					invalid.push(action);
				}
			}
			return(!invalid.length)?true:invalid;
		},
		hasUniqueUrl:function(proxy,verb){
			var url=(proxy.api[verb])?proxy.api[verb].url:null;
			var unique=true;
			for(var action in proxy.api){
				if((unique=(action===verb)?true:(proxy.api[action].url!=url)?true:false)===false){
					break;
				}
			}
			return unique;
		},
		prepare:function(proxy){
			if(!proxy.api){
				proxy.api={};
			}
			for(var verb in this.actions){
				var action=this.actions[verb];
				proxy.api[action]=proxy.api[action]||proxy.url||proxy.directFn;
				if(typeof(proxy.api[action])=='string'){
					proxy.api[action]={
						url:proxy.api[action]
					};
				}
			}
		},
		restify:function(proxy){
			proxy.restful=true;
			for(var verb in this.restActions){
				proxy.api[this.actions[verb]].method=this.restActions[verb];
			}
		}
	};})();
Ext.data.Api.Error=Ext.extend(Ext.Error,{
	constructor:function(message,arg){
		this.arg=arg;
		Ext.Error.call(this,message);
	},
	name:'Ext.data.Api'});
Ext.apply(Ext.data.Api.Error.prototype,{
	lang:{
		'action-url-undefined':'No fallback url defined for this action.  When defining a DataProxy api, please be sure to define an url for each CRUD action in Ext.data.Api.actions or define a default url in addition to your api-configuration.',
		'invalid':'received an invalid API-configuration.  Please ensure your proxy API-configuration contains only the actions defined in Ext.data.Api.actions',
		'invalid-url':'Invalid url.  Please review your proxy configuration.',
		'execute':'Attempted to execute an unknown action.  Valid API actions are defined in Ext.data.Api.actions"'
	}});
Ext.data.SortTypes={
	none:function(s){
		return s;
	},
	stripTagsRE:/<\/?[^>]+>/gi,
	asText:function(s){
		return String(s).replace(this.stripTagsRE,"");
	},
	asUCText:function(s){
		return String(s).toUpperCase().replace(this.stripTagsRE,"");
	},
	asUCString:function(s){
		return String(s).toUpperCase();
	},
	asDate:function(s){
		if(!s){
			return 0;
		}
		if(Ext.isDate(s)){
			return s.getTime();
		}
		return Date.parse(String(s));
	},
	asFloat:function(s){
		var val=parseFloat(String(s).replace(/,/g,""));
		return isNaN(val)?0:val;
	},
	asInt:function(s){
		var val=parseInt(String(s).replace(/,/g,""),10);
		return isNaN(val)?0:val;
	}};
Ext.data.Record=function(data,id){
	this.id=(id||id===0)?id:Ext.data.Record.id(this);
	this.data=data||{};};
Ext.data.Record.create=function(o){
	var f=Ext.extend(Ext.data.Record,{});
	var p=f.prototype;
	p.fields=new Ext.util.MixedCollection(false,function(field){
		return field.name;
	});
	for(var i=0,len=o.length;i<len;i++){
		p.fields.add(new Ext.data.Field(o[i]));
	}
	f.getField=function(name){
		return p.fields.get(name);
	};
	return f;};
Ext.data.Record.PREFIX='ext-record';
Ext.data.Record.AUTO_ID=1;
Ext.data.Record.EDIT='edit';
Ext.data.Record.REJECT='reject';
Ext.data.Record.COMMIT='commit';
Ext.data.Record.id=function(rec){
	rec.phantom=true;
	return[Ext.data.Record.PREFIX,'-',Ext.data.Record.AUTO_ID++].join('');};
Ext.data.Record.prototype={
	dirty:false,
	editing:false,
	error:null,
	modified:null,
	phantom:false,
	join:function(store){
		this.store=store;
	},
	set:function(name,value){
		var isObj=(typeof value==='object');
		if(!isObj&&String(this.data[name])===String(value)){
			return;
		}else if(isObj&&Ext.encode(this.data[name])===Ext.encode(value)){
			return;
		}
		this.dirty=true;
		if(!this.modified){
			this.modified={};
		}
		if(typeof this.modified[name]=='undefined'){
			this.modified[name]=this.data[name];
		}
		this.data[name]=value;
		if(!this.editing){
			this.afterEdit();
		}
	},
	afterEdit:function(){
		if(this.store){
			this.store.afterEdit(this);
		}
	},
	afterReject:function(){
		if(this.store){
			this.store.afterReject(this);
		}
	},
	afterCommit:function(){
		if(this.store){
			this.store.afterCommit(this);
		}
	},
	get:function(name){
		return this.data[name];
	},
	beginEdit:function(){
		this.editing=true;
		this.modified=this.modified||{};
	},
	cancelEdit:function(){
		this.editing=false;
		delete this.modified;
	},
	endEdit:function(){
		this.editing=false;
		if(this.dirty){
			this.afterEdit();
		}
	},
	reject:function(silent){
		var m=this.modified;
		for(var n in m){
			if(typeof m[n]!="function"){
				this.data[n]=m[n];
			}
		}
		this.dirty=false;
		delete this.modified;
		this.editing=false;
		if(silent!==true){
			this.afterReject();
		}
	},
	commit:function(silent){
		this.dirty=false;
		delete this.modified;
		this.editing=false;
		if(silent!==true){
			this.afterCommit();
		}
	},
	getChanges:function(){
		var m=this.modified,cs={};
		for(var n in m){
			if(m.hasOwnProperty(n)){
				cs[n]=this.data[n];
			}
		}
		return cs;
	},
	hasError:function(){
		return this.error!==null;
	},
	clearError:function(){
		this.error=null;
	},
	copy:function(newId){
		return new this.constructor(Ext.apply({},this.data),newId||this.id);
	},
	isModified:function(fieldName){
		return!!(this.modified&&this.modified.hasOwnProperty(fieldName));
	},
	isValid:function(){
		return this.fields.find(function(f){
			return(f.allowBlank===false&&Ext.isEmpty(this.data[f.name]))?true:false;
		},this)?false:true;
	},
	markDirty:function(){
		this.dirty=true;
		if(!this.modified){
			this.modified={};
		}
		this.fields.each(function(f){
			this.modified[f.name]=this.data[f.name];
		},this);
	}};
Ext.StoreMgr=Ext.apply(new Ext.util.MixedCollection(),{
	register:function(){
		for(var i=0,s;(s=arguments[i]);i++){
			this.add(s);
		}
	},
	unregister:function(){
		for(var i=0,s;(s=arguments[i]);i++){
			this.remove(this.lookup(s));
		}
	},
	lookup:function(id){
		if(Ext.isArray(id)){
			var fields=['field1'],expand=!Ext.isArray(id[0]);
			if(!expand){
				for(var i=2,len=id[0].length;i<=len;++i){
					fields.push('field'+i);
				}
			}
			return new Ext.data.ArrayStore({
				fields:fields,
				data:id,
				expandData:expand,
				autoDestroy:true,
				autoCreated:true
			});
		}
		return Ext.isObject(id)?(id.events?id:Ext.create(id,'store')):this.get(id);
	},
	getKey:function(o){
		 return o.storeId;
	}});
Ext.data.Store=function(config){
	this.data=new Ext.util.MixedCollection(false);
	this.data.getKey=function(o){
		return o.id;
	};
	this.baseParams={};
	this.removed=[];
	if(config&&config.data){
		this.inlineData=config.data;
		delete config.data;
	}
	Ext.apply(this,config);
	this.paramNames=Ext.applyIf(this.paramNames||{},this.defaultParamNames);
	if(this.url&&!this.proxy){
		this.proxy=new Ext.data.HttpProxy({url:this.url});
	}
	if(this.restful===true&&this.proxy){
		this.batch=false;
		Ext.data.Api.restify(this.proxy);
	}
	if(this.reader){
		if(!this.recordType){
			this.recordType=this.reader.recordType;
		}
		if(this.reader.onMetaChange){
			this.reader.onMetaChange=this.onMetaChange.createDelegate(this);
		}
		if(this.writer){
			this.writer.meta=this.reader.meta;
			this.pruneModifiedRecords=true;
		}
	}
	if(this.recordType){
		this.fields=this.recordType.prototype.fields;
	}
	this.modified=[];
	this.addEvents(
		'datachanged',
		'metachange',
		'add',
		'remove',
		'update',
		'clear',
		'exception',
		'beforeload',
		'load',
		'loadexception',
		'beforewrite',
		'write'
	);
	if(this.proxy){
		this.relayEvents(this.proxy,['loadexception','exception']);
	}
	if(this.writer){
		this.on({
			scope:this,
			add:this.createRecords,
			remove:this.destroyRecord,
			update:this.updateRecord
		});
	}
	this.sortToggle={};
	if(this.sortField){
		this.setDefaultSort(this.sortField,this.sortDir);
	}else if(this.sortInfo){
		this.setDefaultSort(this.sortInfo.field,this.sortInfo.direction);
	}
	Ext.data.Store.superclass.constructor.call(this);
	if(this.id){
		this.storeId=this.id;
		delete this.id;
	}
	if(this.storeId){
		Ext.StoreMgr.register(this);
	}
	if(this.inlineData){
		this.loadData(this.inlineData);
		delete this.inlineData;
	}else if(this.autoLoad){
		this.load.defer(10,this,[
			typeof this.autoLoad=='object'?
				this.autoLoad:undefined]);
	}};
Ext.extend(Ext.data.Store,Ext.util.Observable,{
	writer:undefined,
	remoteSort:false,
	autoDestroy:false,
	pruneModifiedRecords:false,
	lastOptions:null,
	autoSave:true,
	batch:true,
	restful:false,
	paramNames:undefined,
	defaultParamNames:{
		start:'start',
		limit:'limit',
		sort:'sort',
		dir:'dir'
	},
	destroy:function(){
		if(this.storeId){
			Ext.StoreMgr.unregister(this);
		}
		this.data=null;
		Ext.destroy(this.proxy);
		this.reader=this.writer=null;
		this.purgeListeners();
	},
	add:function(records){
		records=[].concat(records);
		if(records.length<1){
			return;
		}
		for(var i=0,len=records.length;i<len;i++){
			records[i].join(this);
		}
		var index=this.data.length;
		this.data.addAll(records);
		if(this.snapshot){
			this.snapshot.addAll(records);
		}
		this.fireEvent('add',this,records,index);
	},
	addSorted:function(record){
		var index=this.findInsertIndex(record);
		this.insert(index,record);
	},
	remove:function(record){
		var index=this.data.indexOf(record);
		if(index>-1){
			this.data.removeAt(index);
			if(this.pruneModifiedRecords){
				this.modified.remove(record);
			}
			if(this.snapshot){
				this.snapshot.remove(record);
			}
			this.fireEvent('remove',this,record,index);
		}
	},
	removeAt:function(index){
		this.remove(this.getAt(index));
	},
	removeAll:function(){
		this.data.clear();
		if(this.snapshot){
			this.snapshot.clear();
		}
		if(this.pruneModifiedRecords){
			this.modified=[];
		}
		this.fireEvent('clear',this);
	},
	insert:function(index,records){
		records=[].concat(records);
		for(var i=0,len=records.length;i<len;i++){
			this.data.insert(index,records[i]);
			records[i].join(this);
		}
		this.fireEvent('add',this,records,index);
	},
	indexOf:function(record){
		return this.data.indexOf(record);
	},
	indexOfId:function(id){
		return this.data.indexOfKey(id);
	},
	getById:function(id){
		return this.data.key(id);
	},
	getAt:function(index){
		return this.data.itemAt(index);
	},
	getRange:function(start,end){
		return this.data.getRange(start,end);
	},
	storeOptions:function(o){
		o=Ext.apply({},o);
		delete o.callback;
		delete o.scope;
		this.lastOptions=o;
	},
	load:function(options){
		options=options||{};
		this.storeOptions(options);
		if(this.sortInfo&&this.remoteSort){
			var pn=this.paramNames;
			options.params=options.params||{};
			options.params[pn.sort]=this.sortInfo.field;
			options.params[pn.dir]=this.sortInfo.direction;
		}
		try{
			return this.execute('read',null,options);
		}catch(e){
			this.handleException(e);
			return false;
		}
	},
	updateRecord:function(store,record,action){
		if(action==Ext.data.Record.EDIT&&this.autoSave===true&&(!record.phantom||(record.phantom&&record.isValid))){
			this.save();
		}
	},
	createRecords:function(store,rs,index){
		for(var i=0,len=rs.length;i<len;i++){
			if(rs[i].phantom&&rs[i].isValid()){
				rs[i].markDirty();
				this.modified.push(rs[i]);
			}
		}
		if(this.autoSave===true){
			this.save();
		}
	},
	destroyRecord:function(store,record,index){
		if(this.modified.indexOf(record)!=-1){
			this.modified.remove(record);
		}
		if(!record.phantom){
			this.removed.push(record);
			record.lastIndex=index;
			if(this.autoSave===true){
				this.save();
			}
		}
	},
	execute:function(action,rs,options){
		if(!Ext.data.Api.isAction(action)){
			throw new Ext.data.Api.Error('execute',action);
		}
		options=Ext.applyIf(options||{},{
			params:{}
		});
		var doRequest=true;
		if(action==='read'){
			doRequest=this.fireEvent('beforeload',this,options);
		}
		else{
			if(this.writer.listful===true&&this.restful!==true){
				rs=(Ext.isArray(rs))?rs:[rs];
			}
			else if(Ext.isArray(rs)&&rs.length==1){
				rs=rs.shift();
			}
			if((doRequest=this.fireEvent('beforewrite',this,action,rs,options))!==false){
				this.writer.write(action,options.params,rs);
			}
		}
		if(doRequest!==false){
			var params=Ext.apply({},options.params,this.baseParams);
			if(this.writer&&this.proxy.url&&!this.proxy.restful&&!Ext.data.Api.hasUniqueUrl(this.proxy,action)){
				params.xaction=action;
			}
			this.proxy.request(Ext.data.Api.actions[action],rs,params,this.reader,this.createCallback(action,rs),this,options);
		}
		return doRequest;
	},
	save:function(){
		if(!this.writer){
			throw new Ext.data.Store.Error('writer-undefined');
		}
		if(this.removed.length){
			this.doTransaction('destroy',this.removed);
		}
		var rs=[].concat(this.getModifiedRecords());
		if(!rs.length){
			return true;
		}
		var phantoms=[];
		for(var i=rs.length-1;i>=0;i--){
			if(rs[i].phantom===true){
				var rec=rs.splice(i,1).shift();
				if(rec.isValid()){
					phantoms.push(rec);
				}
			}else if(!rs[i].isValid()){
				rs.splice(i,1);
			}
		}
		if(phantoms.length){
			this.doTransaction('create',phantoms);
		}
		if(rs.length){
			this.doTransaction('update',rs);
		}
		return true;
	},
	doTransaction:function(action,rs){
		function transaction(records){
			try{
				this.execute(action,records);
			}catch(e){
				this.handleException(e);
			}
		}
		if(this.batch===false){
			for(var i=0,len=rs.length;i<len;i++){
				transaction.call(this,rs[i]);
			}
		}else{
			transaction.call(this,rs);
		}
	},
	createCallback:function(action,rs){
		var actions=Ext.data.Api.actions;
		return(action=='read')?this.loadRecords:function(data,response,success){
			this['on'+Ext.util.Format.capitalize(action)+'Records'](success,rs,data);
			if(success===true){
				this.fireEvent('write',this,action,data,response,rs);
			}
		};
	},
	clearModified:function(rs){
		if(Ext.isArray(rs)){
			for(var n=rs.length-1;n>=0;n--){
				this.modified.splice(this.modified.indexOf(rs[n]),1);
			}
		}else{
			this.modified.splice(this.modified.indexOf(rs),1);
		}
	},
	reMap:function(record){
		if(Ext.isArray(record)){
			for(var i=0,len=record.length;i<len;i++){
				this.reMap(record[i]);
			}
		}else{
			delete this.data.map[record._phid];
			this.data.map[record.id]=record;
			var index=this.data.keys.indexOf(record._phid);
			this.data.keys.splice(index,1,record.id);
			delete record._phid;
		}
	},
	onCreateRecords:function(success,rs,data){
		if(success===true){
			try{
				this.reader.realize(rs,data);
				this.reMap(rs);
			}
			catch(e){
				this.handleException(e);
				if(Ext.isArray(rs)){
					this.onCreateRecords(success,rs,data);
				}
			}
		}
	},
	onUpdateRecords:function(success,rs,data){
		if(success===true){
			try{
				this.reader.update(rs,data);
			}catch(e){
				this.handleException(e);
				if(Ext.isArray(rs)){
					this.onUpdateRecords(success,rs,data);
				}
			}
		}
	},
	onDestroyRecords:function(success,rs,data){
		rs=(rs instanceof Ext.data.Record)?[rs]:rs;
		for(var i=0,len=rs.length;i<len;i++){
			this.removed.splice(this.removed.indexOf(rs[i]),1);
		}
		if(success===false){
			for(i=rs.length-1;i>=0;i--){
				this.insert(rs[i].lastIndex,rs[i]);
			}
		}
	},
	handleException:function(e){
		Ext.handleError(e);
	},
	reload:function(options){
		this.load(Ext.applyIf(options||{},this.lastOptions));
	},
	loadRecords:function(o,options,success){
		if(!o||success===false){
			if(success!==false){
				this.fireEvent('load',this,[],options);
			}
			if(options.callback){
				options.callback.call(options.scope||this,[],options,false,o);
			}
			return;
		}
		var r=o.records,t=o.totalRecords||r.length;
		if(!options||options.add!==true){
			if(this.pruneModifiedRecords){
				this.modified=[];
			}
			for(var i=0,len=r.length;i<len;i++){
				r[i].join(this);
			}
			if(this.snapshot){
				this.data=this.snapshot;
				delete this.snapshot;
			}
			this.data.clear();
			this.data.addAll(r);
			this.totalLength=t;
			this.applySort();
			this.fireEvent('datachanged',this);
		}else{
			this.totalLength=Math.max(t,this.data.length+r.length);
			this.add(r);
		}
		this.fireEvent('load',this,r,options);
		if(options.callback){
			options.callback.call(options.scope||this,r,options,true);
		}
	},
	loadData:function(o,append){
		var r=this.reader.readRecords(o);
		this.loadRecords(r,{add:append},true);
	},
	getCount:function(){
		return this.data.length||0;
	},
	getTotalCount:function(){
		return this.totalLength||0;
	},
	getSortState:function(){
		return this.sortInfo;
	},
	applySort:function(){
		if(this.sortInfo&&!this.remoteSort){
			var s=this.sortInfo,f=s.field;
			this.sortData(f,s.direction);
		}
	},
	sortData:function(f,direction){
		direction=direction||'ASC';
		var st=this.fields.get(f).sortType;
		var fn=function(r1,r2){
			var v1=st(r1.data[f]),v2=st(r2.data[f]);
			return v1>v2?1:(v1<v2?-1:0);
		};
		this.data.sort(direction,fn);
		if(this.snapshot&&this.snapshot!=this.data){
			this.snapshot.sort(direction,fn);
		}
	},
	setDefaultSort:function(field,dir){
		dir=dir?dir.toUpperCase():'ASC';
		this.sortInfo={field:field,direction:dir};
		this.sortToggle[field]=dir;
	},
	sort:function(fieldName,dir){
		var f=this.fields.get(fieldName);
		if(!f){
			return false;
		}
		if(!dir){
			if(this.sortInfo&&this.sortInfo.field==f.name){
				dir=(this.sortToggle[f.name]||'ASC').toggle('ASC','DESC');
			}else{
				dir=f.sortDir;
			}
		}
		var st=(this.sortToggle)?this.sortToggle[f.name]:null;
		var si=(this.sortInfo)?this.sortInfo:null;
		this.sortToggle[f.name]=dir;
		this.sortInfo={field:f.name,direction:dir};
		if(!this.remoteSort){
			this.applySort();
			this.fireEvent('datachanged',this);
		}else{
			if(!this.load(this.lastOptions)){
				if(st){
					this.sortToggle[f.name]=st;
				}
				if(si){
					this.sortInfo=si;
				}
			}
		}
	},
	each:function(fn,scope){
		this.data.each(fn,scope);
	},
	getModifiedRecords:function(){
		return this.modified;
	},
	createFilterFn:function(property,value,anyMatch,caseSensitive){
		if(Ext.isEmpty(value,false)){
			return false;
		}
		value=this.data.createValueMatcher(value,anyMatch,caseSensitive);
		return function(r){
			return value.test(r.data[property]);
		};
	},
	sum:function(property,start,end){
		var rs=this.data.items,v=0;
		start=start||0;
		end=(end||end===0)?end:rs.length-1;
		for(var i=start;i<=end;i++){
			v+=(rs[i].data[property]||0);
		}
		return v;
	},
	filter:function(property,value,anyMatch,caseSensitive){
		var fn=this.createFilterFn(property,value,anyMatch,caseSensitive);
		return fn?this.filterBy(fn):this.clearFilter();
	},
	filterBy:function(fn,scope){
		this.snapshot=this.snapshot||this.data;
		this.data=this.queryBy(fn,scope||this);
		this.fireEvent('datachanged',this);
	},
	query:function(property,value,anyMatch,caseSensitive){
		var fn=this.createFilterFn(property,value,anyMatch,caseSensitive);
		return fn?this.queryBy(fn):this.data.clone();
	},
	queryBy:function(fn,scope){
		var data=this.snapshot||this.data;
		return data.filterBy(fn,scope||this);
	},
	find:function(property,value,start,anyMatch,caseSensitive){
		var fn=this.createFilterFn(property,value,anyMatch,caseSensitive);
		return fn?this.data.findIndexBy(fn,null,start):-1;
	},
	findExact:function(property,value,start){
		return this.data.findIndexBy(function(rec){
			return rec.get(property)===value;
		},this,start);
	},
	findBy:function(fn,scope,start){
		return this.data.findIndexBy(fn,scope,start);
	},
	collect:function(dataIndex,allowNull,bypassFilter){
		var d=(bypassFilter===true&&this.snapshot)?
				this.snapshot.items:this.data.items;
		var v,sv,r=[],l={};
		for(var i=0,len=d.length;i<len;i++){
			v=d[i].data[dataIndex];
			sv=String(v);
			if((allowNull||!Ext.isEmpty(v))&&!l[sv]){
				l[sv]=true;
				r[r.length]=v;
			}
		}
		return r;
	},
	clearFilter:function(suppressEvent){
		if(this.isFiltered()){
			this.data=this.snapshot;
			delete this.snapshot;
			if(suppressEvent!==true){
				this.fireEvent('datachanged',this);
			}
		}
	},
	isFiltered:function(){
		return this.snapshot&&this.snapshot!=this.data;
	},
	afterEdit:function(record){
		if(this.modified.indexOf(record)==-1){
			this.modified.push(record);
		}
		this.fireEvent('update',this,record,Ext.data.Record.EDIT);
	},
	afterReject:function(record){
		this.modified.remove(record);
		this.fireEvent('update',this,record,Ext.data.Record.REJECT);
	},
	afterCommit:function(record){
		this.modified.remove(record);
		this.fireEvent('update',this,record,Ext.data.Record.COMMIT);
	},
	commitChanges:function(){
		var m=this.modified.slice(0);
		this.modified=[];
		for(var i=0,len=m.length;i<len;i++){
			m[i].commit();
		}
	},
	rejectChanges:function(){
		var m=this.modified.slice(0);
		this.modified=[];
		for(var i=0,len=m.length;i<len;i++){
			m[i].reject();
		}
	},
	onMetaChange:function(meta,rtype,o){
		this.recordType=rtype;
		this.fields=rtype.prototype.fields;
		delete this.snapshot;
		if(meta.sortInfo){
			this.sortInfo=meta.sortInfo;
		}else if(this.sortInfo&&!this.fields.get(this.sortInfo.field)){
			delete this.sortInfo;
		}
		this.modified=[];
		this.fireEvent('metachange',this,this.reader.meta);
	},
	findInsertIndex:function(record){
		this.suspendEvents();
		var data=this.data.clone();
		this.data.add(record);
		this.applySort();
		var index=this.data.indexOf(record);
		this.data=data;
		this.resumeEvents();
		return index;
	},
	setBaseParam:function(name,value){
		this.baseParams=this.baseParams||{};
		this.baseParams[name]=value;
	}});
Ext.reg('store',Ext.data.Store);
Ext.data.Store.Error=Ext.extend(Ext.Error,{
	name:'Ext.data.Store'});
Ext.apply(Ext.data.Store.Error.prototype,{
	lang:{
		'writer-undefined':'Attempted to execute a write-action without a DataWriter installed.'
	}});
Ext.data.Field=function(config){
	if(typeof config=="string"){
		config={name:config};
	}
	Ext.apply(this,config);
	if(!this.type){
		this.type="auto";
	}
	var st=Ext.data.SortTypes;
	if(typeof this.sortType=="string"){
		this.sortType=st[this.sortType];
	}
	if(!this.sortType){
		switch(this.type){
			case"string":
				this.sortType=st.asUCString;
				break;
			case"date":
				this.sortType=st.asDate;
				break;
			default:
				this.sortType=st.none;
		}
	}
	var stripRe=/[\$,%]/g;
	if(!this.convert){
		var cv,dateFormat=this.dateFormat;
		switch(this.type){
			case"":
			case"auto":
			case undefined:
				cv=function(v){return v;};
				break;
			case"string":
				cv=function(v){return(v===undefined||v===null)?'':String(v);};
				break;
			case"int":
				cv=function(v){
					return v!==undefined&&v!==null&&v!==''?
						 parseInt(String(v).replace(stripRe,""),10):'';
					};
				break;
			case"float":
				cv=function(v){
					return v!==undefined&&v!==null&&v!==''?
						 parseFloat(String(v).replace(stripRe,""),10):'';
					};
				break;
			case"bool":
			case"boolean":
				cv=function(v){return v===true||v==="true"||v==1;};
				break;
			case"date":
				cv=function(v){
					if(!v){
						return'';
					}
					if(Ext.isDate(v)){
						return v;
					}
					if(dateFormat){
						if(dateFormat=="timestamp"){
							return new Date(v*1000);
						}
						if(dateFormat=="time"){
							return new Date(parseInt(v,10));
						}
						return Date.parseDate(v,dateFormat);
					}
					var parsed=Date.parse(v);
					return parsed?new Date(parsed):null;
				};
			 break;
		}
		this.convert=cv;
	}};
Ext.data.Field.prototype={
	dateFormat:null,
	defaultValue:"",
	mapping:null,
	sortType:null,
	sortDir:"ASC",
	allowBlank:true};
Ext.data.DataReader=function(meta,recordType){
	this.meta=meta;
	this.recordType=Ext.isArray(recordType)?
		Ext.data.Record.create(recordType):recordType;};
Ext.data.DataReader.prototype={
	buildExtractors:Ext.emptyFn,
	realize:function(rs,data){
		if(Ext.isArray(rs)){
			for(var i=rs.length-1;i>=0;i--){
				if(Ext.isArray(data)){
					this.realize(rs.splice(i,1).shift(),data.splice(i,1).shift());
				}
				else{
					this.realize(rs.splice(i,1).shift(),data);
				}
			}
		}
		else{
			if(Ext.isArray(data)&&data.length==1){
				data=data.shift();
			}
			if(!this.isData(data)){
				throw new Ext.data.DataReader.Error('realize',rs);
			}
			this.buildExtractors();
			var values=this.extractValues(data,rs.fields.items,rs.fields.items.length);
			rs.phantom=false;
			rs._phid=rs.id;
			rs.id=data[this.meta.idProperty];
			rs.data=values;
			rs.commit();
		}
	},
	update:function(rs,data){
		if(Ext.isArray(rs)){
			for(var i=rs.length-1;i>=0;i--){
				if(Ext.isArray(data)){
					this.update(rs.splice(i,1).shift(),data.splice(i,1).shift());
				}
				else{
					this.update(rs.splice(i,1).shift(),data);
				}
			}
		}
		else{
			if(Ext.isArray(data)&&data.length==1){
				data=data.shift();
			}
			if(!this.isData(data)){
				rs.commit();
				throw new Ext.data.DataReader.Error('update',rs);
			}
			this.buildExtractors();
			rs.data=this.extractValues(Ext.apply(rs.data,data),rs.fields.items,rs.fields.items.length);
			rs.commit();
		}
	},
	isData:function(data){
		return(data&&Ext.isObject(data)&&!Ext.isEmpty(data[this.meta.idProperty]))?true:false;
	}};
Ext.data.DataReader.Error=Ext.extend(Ext.Error,{
	constructor:function(message,arg){
		this.arg=arg;
		Ext.Error.call(this,message);
	},
	name:'Ext.data.DataReader'});
Ext.apply(Ext.data.DataReader.Error.prototype,{
	lang:{
		'update':"#update received invalid data from server.  Please see docs for DataReader#update and review your DataReader configuration.",
		'realize':"#realize was called with invalid remote-data.  Please see the docs for DataReader#realize and review your DataReader configuration.",
		'invalid-response':"#readResponse received an invalid response from the server."
	}});
Ext.data.DataWriter=function(config){
	Ext.apply(this,config);};
Ext.data.DataWriter.prototype={
	writeAllFields:false,
	listful:false,
	write:function(action,params,rs){
		this.render(action,rs,params,this[action](rs));
	},
	render:Ext.emptyFn,
	update:function(rs){
		var params={};
		if(Ext.isArray(rs)){
			var data=[],
				ids=[];
			Ext.each(rs,function(val){
				ids.push(val.id);
				data.push(this.updateRecord(val));
			},this);
			params[this.meta.idProperty]=ids;
			params[this.meta.root]=data;
		}
		else if(rs instanceof Ext.data.Record){
			params[this.meta.idProperty]=rs.id;
			params[this.meta.root]=this.updateRecord(rs);
		}
		return params;
	},
	updateRecord:Ext.emptyFn,
	create:function(rs){
		var params={};
		if(Ext.isArray(rs)){
			var data=[];
			Ext.each(rs,function(val){
				data.push(this.createRecord(val));
			},this);
			params[this.meta.root]=data;
		}
		else if(rs instanceof Ext.data.Record){
			params[this.meta.root]=this.createRecord(rs);
		}
		return params;
	},
	createRecord:Ext.emptyFn,
	destroy:function(rs){
		var params={};
		if(Ext.isArray(rs)){
			var data=[],
				ids=[];
			Ext.each(rs,function(val){
				data.push(this.destroyRecord(val));
			},this);
			params[this.meta.root]=data;
		}else if(rs instanceof Ext.data.Record){
			params[this.meta.root]=this.destroyRecord(rs);
		}
		return params;
	},
	destroyRecord:Ext.emptyFn,
	toHash:function(rec){
		var map=rec.fields.map,
			data={},
			raw=(this.writeAllFields===false&&rec.phantom===false)?rec.getChanges():rec.data,
			m;
		Ext.iterate(raw,function(prop,value){
			if((m=map[prop])){
				data[m.mapping?m.mapping:m.name]=value;
			}
		});
		data[this.meta.idProperty]=rec.id;
		return data;
	}};
Ext.data.DataProxy=function(conn){
	conn=conn||{};
	this.api	=conn.api;
	this.url	=conn.url;
	this.restful=conn.restful;
	this.listeners=conn.listeners;
	this.prettyUrls=conn.prettyUrls;
	try{
		Ext.data.Api.prepare(this);
	}catch(e){
		if(e instanceof Ext.data.Api.Error){
			e.toConsole();
		}
	}
	this.addEvents(
		'exception',
		'beforeload',
		'load',
		'loadexception',
		'beforewrite',
		'write'
	);
	Ext.data.DataProxy.superclass.constructor.call(this);};
Ext.extend(Ext.data.DataProxy,Ext.util.Observable,{
	restful:false,
	setApi:function(){
		if(arguments.length==1){
			var valid=Ext.data.Api.isValid(arguments[0]);
			if(valid===true){
				this.api=arguments[0];
			}
			else{
				throw new Ext.data.Api.Error('invalid',valid);
			}
		}
		else if(arguments.length==2){
			if(!Ext.data.Api.isAction(arguments[0])){
				throw new Ext.data.Api.Error('invalid',arguments[0]);
			}
			this.api[arguments[0]]=arguments[1];
		}
		Ext.data.Api.prepare(this);
	},
	isApiAction:function(action){
		return(this.api[action])?true:false;
	},
	request:function(action,rs,params,reader,callback,scope,options){
		if(!this.api[action]&&!this.load){
			throw new Ext.data.DataProxy.Error('action-undefined',action);
		}
		params=params||{};
		if((action===Ext.data.Api.actions.read)?this.fireEvent("beforeload",this,params):this.fireEvent("beforewrite",this,action,rs,params)!==false){
			this.doRequest.apply(this,arguments);
		}
		else{
			callback.call(scope||this,null,options,false);
		}
	},
	load:null,
	doRequest:function(action,rs,params,reader,callback,scope,options){
		this.load(params,reader,callback,scope,options);
	},
	buildUrl:function(action,record){
		record=record||null;
		var url=(this.api[action])?this.api[action].url:this.url;
		if(!url){
			throw new Ext.data.Api.Error('invalid-url',action);
		}
		var format=null;
		var m=url.match(/(.*)(\.\w+)$/);
		if(m){
			format=m[2];
			url=m[1];
		}
		if((this.prettyUrls===true||this.restful===true)&&record instanceof Ext.data.Record&&!record.phantom){
			url+='/'+record.id;
		}
		if(format){
			url+=format;
		}
		return url;
	},
	destroy:function(){
		this.purgeListeners();
	}});
Ext.data.DataProxy.Error=Ext.extend(Ext.Error,{
	constructor:function(message,arg){
		this.arg=arg;
		Ext.Error.call(this,message);
	},
	name:'Ext.data.DataProxy'});
Ext.apply(Ext.data.DataProxy.Error.prototype,{
	lang:{
		'action-undefined':"DataProxy attempted to execute an API-action but found an undefined url / function.  Please review your Proxy url/api-configuration.",
		'api-invalid':'Recieved an invalid API-configuration.  Please ensure your proxy API-configuration contains only the actions from Ext.data.Api.actions.'
	}});
Ext.data.ScriptTagProxy=function(config){
	Ext.apply(this,config);
	Ext.data.ScriptTagProxy.superclass.constructor.call(this,config);
	this.head=document.getElementsByTagName("head")[0];
	};
Ext.data.ScriptTagProxy.TRANS_ID=1000;
Ext.extend(Ext.data.ScriptTagProxy,Ext.data.DataProxy,{
	timeout:30000,
	callbackParam:"callback",
	nocache:true,
	doRequest:function(action,rs,params,reader,callback,scope,arg){
		var p=Ext.urlEncode(Ext.apply(params,this.extraParams));
		var url=this.buildUrl(action,rs);
		if(!url){
			throw new Ext.data.Api.Error('invalid-url',url);
		}
		url=Ext.urlAppend(url,p);
		if(this.nocache){
			url=Ext.urlAppend(url,'_dc='+(new Date().getTime()));
		}
		var transId=++Ext.data.ScriptTagProxy.TRANS_ID;
		var trans={
			id:transId,
			action:action,
			cb:"stcCallback"+transId,
			scriptId:"stcScript"+transId,
			params:params,
			arg:arg,
			url:url,
			callback:callback,
			scope:scope,
			reader:reader
		};
		window[trans.cb]=this.createCallback(action,rs,trans);
		url+=String.format("&{0}={1}",this.callbackParam,trans.cb);
		if(this.autoAbort!==false){
			this.abort();
		}
		trans.timeoutId=this.handleFailure.defer(this.timeout,this,[trans]);
		var script=document.createElement("script");
		script.setAttribute("src",url);
		script.setAttribute("type","text/javascript");
		script.setAttribute("id",trans.scriptId);
		this.head.appendChild(script);
		this.trans=trans;
	},
	createCallback:function(action,rs,trans){
		var self=this;
		return function(res){
			self.trans=false;
			self.destroyTrans(trans,true);
			if(action===Ext.data.Api.actions.read){
				self.onRead.call(self,action,trans,res);
			}else{
				self.onWrite.call(self,action,trans,res,rs);
			}
		};
	},
	onRead:function(action,trans,res){
		var result;
		try{
			result=trans.reader.readRecords(res);
		}catch(e){
			this.fireEvent("loadexception",this,trans,res,e);
			this.fireEvent('exception',this,'response',action,trans,res,e);
			trans.callback.call(trans.scope||window,null,trans.arg,false);
			return;
		}
		if(result.success===false){
			this.fireEvent('loadexception',this,trans,res);
			this.fireEvent('exception',this,'remote',action,trans,res,null);
		}else{
			this.fireEvent("load",this,res,trans.arg);
		}
		trans.callback.call(trans.scope||window,result,trans.arg,result.success);
	},
	onWrite:function(action,trans,res,rs){
		var reader=trans.reader;
		try{
			reader.readResponse(action,res);
		}catch(e){
			this.fireEvent('exception',this,'response',action,trans,res,e);
			trans.callback.call(trans.scope||window,null,res,false);
			return;
		}
		if(!res[reader.meta.successProperty]===true){
			this.fireEvent('exception',this,'remote',action,trans,res,rs);
			trans.callback.call(trans.scope||window,null,res,false);
			return;
		}
		this.fireEvent("write",this,action,res[reader.meta.root],res,rs,trans.arg);
		trans.callback.call(trans.scope||window,res[reader.meta.root],res,true);
	},
	isLoading:function(){
		return this.trans?true:false;
	},
	abort:function(){
		if(this.isLoading()){
			this.destroyTrans(this.trans);
		}
	},
	destroyTrans:function(trans,isLoaded){
		this.head.removeChild(document.getElementById(trans.scriptId));
		clearTimeout(trans.timeoutId);
		if(isLoaded){
			window[trans.cb]=undefined;
			try{
				delete window[trans.cb];
			}catch(e){}
		}else{
			window[trans.cb]=function(){
				window[trans.cb]=undefined;
				try{
					delete window[trans.cb];
				}catch(e){}
			};
		}
	},
	handleFailure:function(trans){
		this.trans=false;
		this.destroyTrans(trans,false);
		if(trans.action===Ext.data.Api.actions.read){
			this.fireEvent("loadexception",this,null,trans.arg);
		}
		this.fireEvent('exception',this,'response',trans.action,{
			response:null,
			options:trans.arg
		});
		trans.callback.call(trans.scope||window,null,trans.arg,false);
	},
	destroy:function(){
		this.abort();
		Ext.data.ScriptTagProxy.superclass.destroy.call(this);
	}});
Ext.data.HttpProxy=function(conn){
	Ext.data.HttpProxy.superclass.constructor.call(this,conn);
	this.conn=conn;
	this.conn.url=null;
	this.useAjax=!conn||!conn.events;
	var actions=Ext.data.Api.actions;
	this.activeRequest={};
	for(var verb in actions){
		this.activeRequest[actions[verb]]=undefined;
	}};
Ext.extend(Ext.data.HttpProxy,Ext.data.DataProxy,{
	getConnection:function(){
		return this.useAjax?Ext.Ajax:this.conn;
	},
	setUrl:function(url,makePermanent){
		this.conn.url=url;
		if(makePermanent===true){
			this.url=url;
			Ext.data.Api.prepare(this);
		}
	},
	doRequest:function(action,rs,params,reader,cb,scope,arg){
		var o={
			method:(this.api[action])?this.api[action]['method']:undefined,
			request:{
				callback:cb,
				scope:scope,
				arg:arg
			},
			reader:reader,
			callback:this.createCallback(action,rs),
			scope:this
		};
		if(typeof(params[reader.meta.root])==='object'){
			o.jsonData=params;
		}else{
			o.params=params||{};
		}
		if(this.conn.url===null){
			this.conn.url=this.buildUrl(action,rs);
		}
		else if(this.restful===true&&rs instanceof Ext.data.Record&&!rs.phantom){
			this.conn.url+='/'+rs.id;
		}
		if(this.useAjax){
			Ext.applyIf(o,this.conn);
			if(this.activeRequest[action]){
			}
			this.activeRequest[action]=Ext.Ajax.request(o);
		}else{
			this.conn.request(o);
		}
		this.conn.url=null;
	},
	createCallback:function(action,rs){
		return function(o,success,response){
			this.activeRequest[action]=undefined;
			if(!success){
				if(action===Ext.data.Api.actions.read){
					this.fireEvent('loadexception',this,o,response);
				}
				this.fireEvent('exception',this,'response',action,o,response);
				o.request.callback.call(o.request.scope,null,o.request.arg,false);
				return;
			}
			if(action===Ext.data.Api.actions.read){
				this.onRead(action,o,response);
			}else{
				this.onWrite(action,o,response,rs);
			}
		}
	},
	onRead:function(action,o,response){
		var result;
		try{
			result=o.reader.read(response);
		}catch(e){
			this.fireEvent('loadexception',this,o,response,e);
			this.fireEvent('exception',this,'response',action,o,response,e);
			o.request.callback.call(o.request.scope,null,o.request.arg,false);
			return;
		}
		if(result.success===false){
			this.fireEvent('loadexception',this,o,response);
			var res=o.reader.readResponse(action,response);
			this.fireEvent('exception',this,'remote',action,o,res,null);
		}
		else{
			this.fireEvent('load',this,o,o.request.arg);
		}
		o.request.callback.call(o.request.scope,result,o.request.arg,result.success);
	},
	onWrite:function(action,o,response,rs){
		var reader=o.reader;
		var res;
		try{
			res=reader.readResponse(action,response);
		}catch(e){
			this.fireEvent('exception',this,'response',action,o,response,e);
			o.request.callback.call(o.request.scope,null,o.request.arg,false);
			return;
		}
		if(res[reader.meta.successProperty]===false){
			this.fireEvent('exception',this,'remote',action,o,res,rs);
		}else{
			this.fireEvent('write',this,action,res[reader.meta.root],res,rs,o.request.arg);
		}
		o.request.callback.call(o.request.scope,res[reader.meta.root],res,res[reader.meta.successProperty]);
	},
	destroy:function(){
		if(!this.useAjax){
			this.conn.abort();
		}else if(this.activeRequest){
			var actions=Ext.data.Api.actions;
			for(var verb in actions){
				if(this.activeRequest[actions[verb]]){
					Ext.Ajax.abort(this.activeRequest[actions[verb]]);
				}
			}
		}
		Ext.data.HttpProxy.superclass.destroy.call(this);
	}});
Ext.data.MemoryProxy=function(data){
	var api={};
	api[Ext.data.Api.actions.read]=true;
	Ext.data.MemoryProxy.superclass.constructor.call(this,{
		api:api
	});
	this.data=data;};
Ext.extend(Ext.data.MemoryProxy,Ext.data.DataProxy,{
	doRequest:function(action,rs,params,reader,callback,scope,arg){
		params=params||{};
		var result;
		try{
			result=reader.readRecords(this.data);
		}catch(e){
			this.fireEvent("loadexception",this,null,arg,e);
			this.fireEvent('exception',this,'response',action,arg,null,e);
			callback.call(scope,null,arg,false);
			return;
		}
		callback.call(scope,result,arg,true);
	}});
Ext.data.JsonWriter=function(config){
	Ext.data.JsonWriter.superclass.constructor.call(this,config);
	if(this.returnJson!=undefined){
		this.encode=this.returnJson;
	}}
Ext.extend(Ext.data.JsonWriter,Ext.data.DataWriter,{
	returnJson:undefined,
	encode:true,
	render:function(action,rs,params,data){
		Ext.apply(params,data);
		if(this.encode===true){
			if(Ext.isArray(rs)&&data[this.meta.idProperty]){
				params[this.meta.idProperty]=Ext.encode(params[this.meta.idProperty]);
			}
			params[this.meta.root]=Ext.encode(params[this.meta.root]);
		}
	},
	createRecord:function(rec){
		return this.toHash(rec);
	},
	updateRecord:function(rec){
		return this.toHash(rec);
	},
	destroyRecord:function(rec){
		return rec.id;
	}});
Ext.data.JsonReader=function(meta,recordType){
	meta=meta||{};
	Ext.applyIf(meta,{
		idProperty:'id',
		successProperty:'success',
		totalProperty:'total'
	});
	Ext.data.JsonReader.superclass.constructor.call(this,meta,recordType||meta.fields);};
Ext.extend(Ext.data.JsonReader,Ext.data.DataReader,{
	read:function(response){
		var json=response.responseText;
		var o=Ext.decode(json);
		if(!o){
			throw{message:"JsonReader.read: Json object not found"};
		}
		return this.readRecords(o);
	},
	onMetaChange:function(meta,recordType,o){
	},
	simpleAccess:function(obj,subsc){
		return obj[subsc];
	},
	getJsonAccessor:function(){
		var re=/[\[\.]/;
		return function(expr){
			try{
				return(re.test(expr))?
				new Function("obj","return obj."+expr):
				function(obj){
					return obj[expr];
				};
			}catch(e){}
			return Ext.emptyFn;
		};
	}(),
	readRecords:function(o){
		this.jsonData=o;
		if(o.metaData){
			delete this.ef;
			this.meta=o.metaData;
			this.recordType=Ext.data.Record.create(o.metaData.fields);
			this.onMetaChange(this.meta,this.recordType,o);
		}
		var s=this.meta,Record=this.recordType,
			f=Record.prototype.fields,fi=f.items,fl=f.length,v;
		this.buildExtractors();
		var root=this.getRoot(o),c=root.length,totalRecords=c,success=true;
		if(s.totalProperty){
			v=parseInt(this.getTotal(o),10);
			if(!isNaN(v)){
				totalRecords=v;
			}
		}
		if(s.successProperty){
			v=this.getSuccess(o);
			if(v===false||v==='false'){
				success=false;
			}
		}
		var records=[];
		for(var i=0;i<c;i++){
			var n=root[i];
			var record=new Record(this.extractValues(n,fi,fl),this.getId(n));
			record.json=n;
			records[i]=record;
		}
		return{
			success:success,
			records:records,
			totalRecords:totalRecords
		};
	},
	buildExtractors:function(){
		if(this.ef){
			return;
		}
		var s=this.meta,Record=this.recordType,
			f=Record.prototype.fields,fi=f.items,fl=f.length;
		if(s.totalProperty){
			this.getTotal=this.getJsonAccessor(s.totalProperty);
		}
		if(s.successProperty){
			this.getSuccess=this.getJsonAccessor(s.successProperty);
		}
		this.getRoot=s.root?this.getJsonAccessor(s.root):function(p){return p;};
		if(s.id||s.idProperty){
			var g=this.getJsonAccessor(s.id||s.idProperty);
			this.getId=function(rec){
				var r=g(rec);
				return(r===undefined||r==="")?null:r;
			};
		}else{
			this.getId=function(){return null;};
		}
		var ef=[];
		for(var i=0;i<fl;i++){
			f=fi[i];
			var map=(f.mapping!==undefined&&f.mapping!==null)?f.mapping:f.name;
			ef.push(this.getJsonAccessor(map));
		}
		this.ef=ef;
	},
	extractValues:function(data,items,len){
		var f,values={};
		for(var j=0;j<len;j++){
			f=items[j];
			var v=this.ef[j](data);
			values[f.name]=f.convert((v!==undefined)?v:f.defaultValue,data);
		}
		return values;
	},
	readResponse:function(action,response){
		var o=(response.responseText!==undefined)?Ext.decode(response.responseText):response;
		if(!o){
			throw new Ext.data.JsonReader.Error('response');
		}
		if(Ext.isEmpty(o[this.meta.successProperty])){
			throw new Ext.data.JsonReader.Error('successProperty-response',this.meta.successProperty);
		}
		if((action===Ext.data.Api.actions.create||action===Ext.data.Api.actions.update)){
			if(Ext.isEmpty(o[this.meta.root])){
				throw new Ext.data.JsonReader.Error('root-emtpy',this.meta.root);
			}
			else if(o[this.meta.root]===undefined){
				throw new Ext.data.JsonReader.Error('root-undefined-response',this.meta.root);
			}
		}
		this.ef=this.buildExtractors();
		return o;
	}});
Ext.data.JsonReader.Error=Ext.extend(Ext.Error,{
	constructor:function(message,arg){
		this.arg=arg;
		Ext.Error.call(this,message);
	},
	name:'Ext.data.JsonReader'});
Ext.apply(Ext.data.JsonReader.Error.prototype,{
	lang:{
		'response':"An error occurred while json-decoding your server response",
		'successProperty-response':'Could not locate your "successProperty" in your server response.  Please review your JsonReader config to ensure the config-property "successProperty" matches the property in your server-response.  See the JsonReader docs.',
		'root-undefined-response':'Could not locate your "root" property in your server response.  Please review your JsonReader config to ensure the config-property "root" matches the property your server-response.  See the JsonReader docs.',
		'root-undefined-config':'Your JsonReader was configured without a "root" property.  Please review your JsonReader config and make sure to define the root property.  See the JsonReader docs.',
		'idProperty-undefined':'Your JsonReader was configured without an "idProperty"  Please review your JsonReader configuration and ensure the "idProperty" is set (e.g.: "id").  See the JsonReader docs.',
		'root-emtpy':'Data was expected to be returned by the server in the "root" property of the response.  Please review your JsonReader configuration to ensure the "root" property matches that returned in the server-response.  See JsonReader docs.'
	}});
Ext.data.ArrayReader=Ext.extend(Ext.data.JsonReader,{
	readRecords:function(o){
		this.arrayData=o;
		var s=this.meta,
			sid=s?Ext.num(s.idIndex,s.id):null,
			recordType=this.recordType,
			fields=recordType.prototype.fields,
			records=[],
			v;
		if(!this.getRoot){
			this.getRoot=s.root?this.getJsonAccessor(s.root):function(p){return p;};
			if(s.totalProperty){
				this.getTotal=this.getJsonAccessor(s.totalProperty);
			}
		}
		var root=this.getRoot(o);
		for(var i=0;i<root.length;i++){
			var n=root[i];
			var values={};
			var id=((sid||sid===0)&&n[sid]!==undefined&&n[sid]!==""?n[sid]:null);
			for(var j=0,jlen=fields.length;j<jlen;j++){
				var f=fields.items[j];
				var k=f.mapping!==undefined&&f.mapping!==null?f.mapping:j;
				v=n[k]!==undefined?n[k]:f.defaultValue;
				v=f.convert(v,n);
				values[f.name]=v;
			}
			var record=new recordType(values,id);
			record.json=n;
			records[records.length]=record;
		}
		var totalRecords=records.length;
		if(s.totalProperty){
			v=parseInt(this.getTotal(o),10);
			if(!isNaN(v)){
				totalRecords=v;
			}
		}
		return{
			records:records,
			totalRecords:totalRecords
		};
	}});
Ext.data.ArrayStore=Ext.extend(Ext.data.Store,{
	constructor:function(config){
		Ext.data.ArrayStore.superclass.constructor.call(this,Ext.apply(config,{
			reader:new Ext.data.ArrayReader(config)
		}));
	},
	loadData:function(data,append){
		if(this.expandData===true){
			var r=[];
			for(var i=0,len=data.length;i<len;i++){
				r[r.length]=[data[i]];
			}
			data=r;
		}
		Ext.data.ArrayStore.superclass.loadData.call(this,data,append);
	}});
Ext.reg('arraystore',Ext.data.ArrayStore);
Ext.data.SimpleStore=Ext.data.ArrayStore;
Ext.reg('simplestore',Ext.data.SimpleStore);
Ext.data.JsonStore=Ext.extend(Ext.data.Store,{
	constructor:function(config){
		Ext.data.JsonStore.superclass.constructor.call(this,Ext.apply(config,{
			reader:new Ext.data.JsonReader(config)
		}));
	}});
Ext.reg('jsonstore',Ext.data.JsonStore);
Ext.data.XmlWriter=Ext.extend(Ext.data.DataWriter,{
	render:function(action,rs,params,data){
	},
	createRecord:function(rec){
	},
	updateRecord:function(rec){
	},
	destroyRecord:function(rec){
	}});
Ext.data.XmlReader=function(meta,recordType){
	meta=meta||{};
	Ext.data.XmlReader.superclass.constructor.call(this,meta,recordType||meta.fields);};
Ext.extend(Ext.data.XmlReader,Ext.data.DataReader,{
	read:function(response){
		var doc=response.responseXML;
		if(!doc){
			throw{message:"XmlReader.read: XML Document not available"};
		}
		return this.readRecords(doc);
	},
	readRecords:function(doc){
		this.xmlData=doc;
		var root=doc.documentElement||doc;
		var q=Ext.DomQuery;
		var recordType=this.recordType,fields=recordType.prototype.fields;
		var sid=this.meta.idPath||this.meta.id;
		var totalRecords=0,success=true;
		if(this.meta.totalRecords){
			totalRecords=q.selectNumber(this.meta.totalRecords,root,0);
		}
		if(this.meta.success){
			var sv=q.selectValue(this.meta.success,root,true);
			success=sv!==false&&sv!=='false';
		}
		var records=[];
		var ns=q.select(this.meta.record,root);
		for(var i=0,len=ns.length;i<len;i++){
			var n=ns[i];
			var values={};
			var id=sid?q.selectValue(sid,n):undefined;
			for(var j=0,jlen=fields.length;j<jlen;j++){
				var f=fields.items[j];
				var v=q.selectValue(Ext.value(f.mapping,f.name,true),n,f.defaultValue);
				v=f.convert(v,n);
				values[f.name]=v;
			}
			var record=new recordType(values,id);
			record.node=n;
			records[records.length]=record;
		}
		return{
			success:success,
			records:records,
			totalRecords:totalRecords||records.length
		};
	},
	readResponse:Ext.emptyFn});
Ext.data.XmlStore=Ext.extend(Ext.data.Store,{
	constructor:function(config){
		Ext.data.XmlStore.superclass.constructor.call(this,Ext.apply(config,{
			reader:new Ext.data.XmlReader(config)
		}));
	}});
Ext.reg('xmlstore',Ext.data.XmlStore);
Ext.data.GroupingStore=Ext.extend(Ext.data.Store,{
	constructor:function(config){
		Ext.data.GroupingStore.superclass.constructor.call(this,config);
		this.applyGroupField();
	},
	remoteGroup:false,
	groupOnSort:false,
	groupDir:'ASC',
	clearGrouping:function(){
		this.groupField=false;
		if(this.remoteGroup){
			if(this.baseParams){
				delete this.baseParams.groupBy;
			}
			var lo=this.lastOptions;
			if(lo&&lo.params){
				delete lo.params.groupBy;
			}
			this.reload();
		}else{
			this.applySort();
			this.fireEvent('datachanged',this);
		}
	},
	groupBy:function(field,forceRegroup,direction){
		direction=direction?(String(direction).toUpperCase()=='DESC'?'DESC':'ASC'):this.groupDir;
		if(this.groupField==field&&this.groupDir==direction&&!forceRegroup){
			return;
		}
		this.groupField=field;
		this.groupDir=direction;
		this.applyGroupField();
		if(this.groupOnSort){
			this.sort(field,direction);
			return;
		}
		if(this.remoteGroup){
			this.reload();
		}else{
			var si=this.sortInfo||{};
			if(si.field!=field||si.direction!=direction){
				this.applySort();
			}else{
				this.sortData(field,direction);
			}
			this.fireEvent('datachanged',this);
		}
	},
	applyGroupField:function(){
		if(this.remoteGroup){
			if(!this.baseParams){
				this.baseParams={};
			}
			this.baseParams.groupBy=this.groupField;
			this.baseParams.groupDir=this.groupDir;
		}
	},
	applySort:function(){
		Ext.data.GroupingStore.superclass.applySort.call(this);
		if(!this.groupOnSort&&!this.remoteGroup){
			var gs=this.getGroupState();
			if(gs&&(gs!=this.sortInfo.field||this.groupDir!=this.sortInfo.direction)){
				this.sortData(this.groupField,this.groupDir);
			}
		}
	},
	applyGrouping:function(alwaysFireChange){
		if(this.groupField!==false){
			this.groupBy(this.groupField,true,this.groupDir);
			return true;
		}else{
			if(alwaysFireChange===true){
				this.fireEvent('datachanged',this);
			}
			return false;
		}
	},
	getGroupState:function(){
		return this.groupOnSort&&this.groupField!==false?
			(this.sortInfo?this.sortInfo.field:undefined):this.groupField;
	}});
Ext.reg('groupingstore',Ext.data.GroupingStore);
Ext.data.DirectProxy=function(config){
	Ext.apply(this,config);
	if(typeof this.paramOrder=='string'){
		this.paramOrder=this.paramOrder.split(/[\s,|]/);
	}
	Ext.data.DirectProxy.superclass.constructor.call(this,config);};
Ext.extend(Ext.data.DirectProxy,Ext.data.DataProxy,{
	paramOrder:undefined,
	paramsAsHash:true,
	directFn:undefined,
	doRequest:function(action,rs,params,reader,callback,scope,options){
		var args=[];
		var directFn=this.api[action]||this.directFn;
		switch(action){
			case Ext.data.Api.actions.create:
				args.push(params[reader.meta.root]);
				break;
			case Ext.data.Api.actions.read:
				if(this.paramOrder){
					for(var i=0,len=this.paramOrder.length;i<len;i++){
						args.push(params[this.paramOrder[i]]);
					}
				}else if(this.paramsAsHash){
					args.push(params);
				}
				break;
			case Ext.data.Api.actions.update:
				args.push(params[reader.meta.idProperty]);
				args.push(params[reader.meta.root]);
				break;
			case Ext.data.Api.actions.destroy:
				args.push(params[reader.meta.root]);
				break;
		}
		var trans={
			params:params||{},
			callback:callback,
			scope:scope,
			arg:options,
			reader:reader
		};
		args.push(this.createCallback(action,rs,trans),this);
		directFn.apply(window,args);
	},
	createCallback:function(action,rs,trans){
		return function(result,res){
			if(!res.status){
				if(action===Ext.data.Api.actions.read){
					this.fireEvent("loadexception",this,trans,res,null);
				}
				this.fireEvent('exception',this,'remote',action,trans,res,null);
				trans.callback.call(trans.scope,null,trans.arg,false);
				return;
			}
			if(action===Ext.data.Api.actions.read){
				this.onRead(action,trans,result,res);
			}else{
				this.onWrite(action,trans,result,res,rs);
			}
		};
	},
	onRead:function(action,trans,result,res){
		var records;
		try{
			records=trans.reader.readRecords(result);
		}
		catch(ex){
			this.fireEvent("loadexception",this,trans,res,ex);
			this.fireEvent('exception',this,'response',action,trans,res,ex);
			trans.callback.call(trans.scope,null,trans.arg,false);
			return;
		}
		this.fireEvent("load",this,res,trans.arg);
		trans.callback.call(trans.scope,records,trans.arg,true);
	},
	onWrite:function(action,trans,result,res,rs){
		this.fireEvent("write",this,action,result,res,rs,trans.arg);
		trans.callback.call(trans.scope,result,res,true);
	}});
Ext.data.DirectStore=function(c){
	c.batchTransactions=false;
	Ext.data.DirectStore.superclass.constructor.call(this,Ext.apply(c,{
		proxy:(typeof(c.proxy)=='undefined')?new Ext.data.DirectProxy(Ext.copyTo({},c,'paramOrder,paramsAsHash,directFn,api')):c.proxy,
		reader:(typeof(c.reader)=='undefined'&&typeof(c.fields)=='object')?new Ext.data.JsonReader(Ext.copyTo({},c,'totalProperty,root,idProperty'),c.fields):c.reader
	}));};
Ext.extend(Ext.data.DirectStore,Ext.data.Store,{});
Ext.reg('directstore',Ext.data.DirectStore);
Ext.Direct=Ext.extend(Ext.util.Observable,{
	exceptions:{
		TRANSPORT:'xhr',
		PARSE:'parse',
		LOGIN:'login',
		SERVER:'exception'
	},
	constructor:function(){
		this.addEvents(
			'event',
			'exception'
		);
		this.transactions={};
		this.providers={};
	},
	addProvider:function(provider){
		var a=arguments;
		if(a.length>1){
			for(var i=0,len=a.length;i<len;i++){
				this.addProvider(a[i]);
			}
			return;
		}
		if(!provider.events){
			provider=new Ext.Direct.PROVIDERS[provider.type](provider);
		}
		provider.id=provider.id||Ext.id();
		this.providers[provider.id]=provider;
		provider.on('data',this.onProviderData,this);
		provider.on('exception',this.onProviderException,this);
		if(!provider.isConnected()){
			provider.connect();
		}
		return provider;
	},
	getProvider:function(id){
		return this.providers[id];
	},
	removeProvider:function(id){
		var provider=id.id?id:this.providers[id.id];
		provider.un('data',this.onProviderData,this);
		provider.un('exception',this.onProviderException,this);
		delete this.providers[provider.id];
		return provider;
	},
	addTransaction:function(t){
		this.transactions[t.tid]=t;
		return t;
	},
	removeTransaction:function(t){
		delete this.transactions[t.tid||t];
		return t;
	},
	getTransaction:function(tid){
		return this.transactions[tid.tid||tid];
	},
	onProviderData:function(provider,e){
		if(Ext.isArray(e)){
			for(var i=0,len=e.length;i<len;i++){
				this.onProviderData(provider,e[i]);
			}
			return;
		}
		if(e.name&&e.name!='event'&&e.name!='exception'){
			this.fireEvent(e.name,e);
		}else if(e.type=='exception'){
			this.fireEvent('exception',e);
		}
		this.fireEvent('event',e,provider);
	},
	createEvent:function(response,extraProps){
		return new Ext.Direct.eventTypes[response.type](Ext.apply(response,extraProps));
	}});
Ext.Direct=new Ext.Direct();
Ext.Direct.TID=1;
Ext.Direct.PROVIDERS={};
Ext.Direct.Transaction=function(config){
	Ext.apply(this,config);
	this.tid=++Ext.Direct.TID;
	this.retryCount=0;};
Ext.Direct.Transaction.prototype={
	send:function(){
		this.provider.queueTransaction(this);
	},
	retry:function(){
		this.retryCount++;
		this.send();
	},
	getProvider:function(){
		return this.provider;
	}};Ext.Direct.Event=function(config){
	Ext.apply(this,config);}
Ext.Direct.Event.prototype={
	status:true,
	getData:function(){
		return this.data;
	}};
Ext.Direct.RemotingEvent=Ext.extend(Ext.Direct.Event,{
	type:'rpc',
	getTransaction:function(){
		return this.transaction||Ext.Direct.getTransaction(this.tid);
	}});
Ext.Direct.ExceptionEvent=Ext.extend(Ext.Direct.RemotingEvent,{
	status:false,
	type:'exception'});
Ext.Direct.eventTypes={
	'rpc':Ext.Direct.RemotingEvent,
	'event':Ext.Direct.Event,
	'exception':Ext.Direct.ExceptionEvent};
Ext.direct.Provider=Ext.extend(Ext.util.Observable,{
	priority:1,
	constructor:function(config){
		Ext.apply(this,config);
		this.addEvents(
			'connect',
			'disconnect',
			'data',
			'exception'
		);
		Ext.direct.Provider.superclass.constructor.call(this,config);
	},
	isConnected:function(){
		return false;
	},
	connect:Ext.emptyFn,
	disconnect:Ext.emptyFn});
Ext.direct.JsonProvider=Ext.extend(Ext.direct.Provider,{
	parseResponse:function(xhr){
		if(!Ext.isEmpty(xhr.responseText)){
			if(typeof xhr.responseText=='object'){
				return xhr.responseText;
			}
			return Ext.decode(xhr.responseText);
		}
		return null;
	},
	getEvents:function(xhr){
		var data=null;
		try{
			data=this.parseResponse(xhr);
		}catch(e){
			var event=new Ext.Direct.ExceptionEvent({
				data:e,
				xhr:xhr,
				code:Ext.Direct.exceptions.PARSE,
				message:'Error parsing json response: \n\n '+data
			})
			return[event];
		}
		var events=[];
		if(Ext.isArray(data)){
			for(var i=0,len=data.length;i<len;i++){
				events.push(Ext.Direct.createEvent(data[i]));
			}
		}else{
			events.push(Ext.Direct.createEvent(data));
		}
		return events;
	}});
Ext.direct.PollingProvider=Ext.extend(Ext.direct.JsonProvider,{
	priority:3,
	interval:3000,
	constructor:function(config){
		Ext.direct.PollingProvider.superclass.constructor.call(this,config);
		this.addEvents(
			'beforepoll',
			'poll'
		);
	},
	isConnected:function(){
		return!!this.pollTask;
	},
	connect:function(){
		if(this.url&&!this.pollTask){
			this.pollTask=Ext.TaskMgr.start({
				run:function(){
					if(this.fireEvent('beforepoll',this)!==false){
						if(typeof this.url=='function'){
							this.url(this.baseParams);
						}else{
							Ext.Ajax.request({
								url:this.url,
								callback:this.onData,
								scope:this,
								params:this.baseParams
							});
						}
					}
				},
				interval:this.interval,
				scope:this
			});
			this.fireEvent('connect',this);
		}else if(!this.url){
			throw'Error initializing PollingProvider, no url configured.';
		}
	},
	disconnect:function(){
		if(this.pollTask){
			Ext.TaskMgr.stop(this.pollTask);
			delete this.pollTask;
			this.fireEvent('disconnect',this);
		}
	},
	onData:function(opt,success,xhr){
		if(success){
			var events=this.getEvents(xhr);
			for(var i=0,len=events.length;i<len;i++){
				var e=events[i];
				this.fireEvent('data',this,e);
			}
		}else{
			var e=new Ext.Direct.ExceptionEvent({
				data:e,
				code:Ext.Direct.exceptions.TRANSPORT,
				message:'Unable to connect to the server.',
				xhr:xhr
			});
			this.fireEvent('data',this,e);
		}
	}});
Ext.Direct.PROVIDERS['polling']=Ext.direct.PollingProvider;
Ext.direct.RemotingProvider=Ext.extend(Ext.direct.JsonProvider,{
	enableBuffer:10,
	maxRetries:1,
	constructor:function(config){
		Ext.direct.RemotingProvider.superclass.constructor.call(this,config);
		this.addEvents(
			'beforecall',
			'call'
		);
		this.namespace=(typeof this.namespace==='string')?Ext.ns(this.namespace):this.namespace||window;
		this.transactions={};
		this.callBuffer=[];
	},
	initAPI:function(){
		var o=this.actions;
		for(var c in o){
			var cls=this.namespace[c]||(this.namespace[c]={});
			var ms=o[c];
			for(var i=0,len=ms.length;i<len;i++){
				var m=ms[i];
				cls[m.name]=this.createMethod(c,m);
			}
		}
	},
	isConnected:function(){
		return!!this.connected;
	},
	connect:function(){
		if(this.url){
			this.initAPI();
			this.connected=true;
			this.fireEvent('connect',this);
		}else if(!this.url){
			throw'Error initializing RemotingProvider, no url configured.';
		}
	},
	disconnect:function(){
		if(this.connected){
			this.connected=false;
			this.fireEvent('disconnect',this);
		}
	},
	onData:function(opt,success,xhr){
		if(success){
			var events=this.getEvents(xhr);
			for(var i=0,len=events.length;i<len;i++){
				var e=events[i];
				var t=this.getTransaction(e);
				this.fireEvent('data',this,e);
				if(t){
					this.doCallback(t,e,true);
					Ext.Direct.removeTransaction(t);
				}
			}
		}else{
			var ts=[].concat(opt.ts);
			for(var i=0,len=ts.length;i<len;i++){
				var t=this.getTransaction(ts[i]);
				if(t&&t.retryCount<this.maxRetries){
					t.retry();
				}else{
					var e=new Ext.Direct.ExceptionEvent({
						data:e,
						transaction:t,
						code:Ext.Direct.exceptions.TRANSPORT,
						message:'Unable to connect to the server.',
						xhr:xhr
					});
					this.fireEvent('data',this,e);
					if(t){
						this.doCallback(t,e,false);
						Ext.Direct.removeTransaction(t);
					}
				}
			}
		}
	},
	getCallData:function(t){
		return{
			action:t.action,
			method:t.method,
			data:t.data,
			type:'rpc',
			tid:t.tid
		};
	},
	doSend:function(data){
		var o={
			url:this.url,
			callback:this.onData,
			scope:this,
			ts:data
		};
		var callData;
		if(Ext.isArray(data)){
			callData=[];
			for(var i=0,len=data.length;i<len;i++){
				callData.push(this.getCallData(data[i]));
			}
		}else{
			callData=this.getCallData(data);
		}
		if(this.enableUrlEncode){
			var params={};
			params[typeof this.enableUrlEncode=='string'?this.enableUrlEncode:'data']=Ext.encode(callData);
			o.params=params;
		}else{
			o.jsonData=callData;
		}
		Ext.Ajax.request(o);
	},
	combineAndSend:function(){
		var len=this.callBuffer.length;
		if(len>0){
			this.doSend(len==1?this.callBuffer[0]:this.callBuffer);
			this.callBuffer=[];
		}
	},
	queueTransaction:function(t){
		if(t.form){
			this.processForm(t);
			return;
		}
		this.callBuffer.push(t);
		if(this.enableBuffer){
			if(!this.callTask){
				this.callTask=new Ext.util.DelayedTask(this.combineAndSend,this);
			}
			this.callTask.delay(typeof this.enableBuffer=='number'?this.enableBuffer:10);
		}else{
			this.combineAndSend();
		}
	},
	doCall:function(c,m,args){
		var data=null,hs=args[m.len],scope=args[m.len+1];
		if(m.len!==0){
			data=args.slice(0,m.len);
		}
		var t=new Ext.Direct.Transaction({
			provider:this,
			args:args,
			action:c,
			method:m.name,
			data:data,
			cb:scope&&Ext.isFunction(hs)?hs.createDelegate(scope):hs
		});
		if(this.fireEvent('beforecall',this,t)!==false){
			Ext.Direct.addTransaction(t);
			this.queueTransaction(t);
			this.fireEvent('call',this,t);
		}
	},
	doForm:function(c,m,form,callback,scope){
		var t=new Ext.Direct.Transaction({
			provider:this,
			action:c,
			method:m.name,
			args:[form,callback,scope],
			cb:scope&&Ext.isFunction(callback)?callback.createDelegate(scope):callback,
			isForm:true
		});
		if(this.fireEvent('beforecall',this,t)!==false){
			Ext.Direct.addTransaction(t);
			var isUpload=String(form.getAttribute("enctype")).toLowerCase()=='multipart/form-data',
				params={
					extTID:t.tid,
					extAction:c,
					extMethod:m.name,
					extType:'rpc',
					extUpload:String(isUpload)
				};
			Ext.apply(t,{
				form:Ext.getDom(form),
				isUpload:isUpload,
				params:callback&&Ext.isObject(callback.params)?Ext.apply(params,callback.params):params
			});
			this.fireEvent('call',this,t);
			this.processForm(t);
		}
	},
	processForm:function(t){
		Ext.Ajax.request({
			url:this.url,
			params:t.params,
			callback:this.onData,
			scope:this,
			form:t.form,
			isUpload:t.isUpload,
			ts:t
		});
	},
	createMethod:function(c,m){
		var f;
		if(!m.formHandler){
			f=function(){
				this.doCall(c,m,Array.prototype.slice.call(arguments,0));
			}.createDelegate(this);
		}else{
			f=function(form,callback,scope){
				this.doForm(c,m,form,callback,scope);
			}.createDelegate(this);
		}
		f.directCfg={
			action:c,
			method:m
		};
		return f;
	},
	getTransaction:function(opt){
		return opt&&opt.tid?Ext.Direct.getTransaction(opt.tid):null;
	},
	doCallback:function(t,e){
		var fn=e.status?'success':'failure';
		if(t&&t.cb){
			var hs=t.cb;
			var result=e.result||e.data;
			if(Ext.isFunction(hs)){
				hs(result,e);
			}else{
				Ext.callback(hs[fn],hs.scope,[result,e]);
				Ext.callback(hs.callback,hs.scope,[result,e]);
			}
		}
	}});
Ext.Direct.PROVIDERS['remoting']=Ext.direct.RemotingProvider;
Ext.Resizable=function(el,config){
	this.el=Ext.get(el);
	if(config&&config.wrap){
		config.resizeChild=this.el;
		this.el=this.el.wrap(typeof config.wrap=='object'?config.wrap:{cls:'xresizable-wrap'});
		this.el.id=this.el.dom.id=config.resizeChild.id+'-rzwrap';
		this.el.setStyle('overflow','hidden');
		this.el.setPositioning(config.resizeChild.getPositioning());
		config.resizeChild.clearPositioning();
		if(!config.width||!config.height){
			var csize=config.resizeChild.getSize();
			this.el.setSize(csize.width,csize.height);
		}
		if(config.pinned&&!config.adjustments){
			config.adjustments='auto';
		}
	}
	this.proxy=this.el.createProxy({tag:'div',cls:'x-resizable-proxy',id:this.el.id+'-rzproxy'},Ext.getBody());
	this.proxy.unselectable();
	this.proxy.enableDisplayMode('block');
	Ext.apply(this,config);
	if(this.pinned){
		this.disableTrackOver=true;
		this.el.addClass('x-resizable-pinned');
	}
	var position=this.el.getStyle('position');
	if(position!='absolute'&&position!='fixed'){
		this.el.setStyle('position','relative');
	}
	if(!this.handles){
		this.handles='s,e,se';
		if(this.multiDirectional){
			this.handles+=',n,w';
		}
	}
	if(this.handles=='all'){
		this.handles='n s e w ne nw se sw';
	}
	var hs=this.handles.split(/\s*?[,;]\s*?| /);
	var ps=Ext.Resizable.positions;
	for(var i=0,len=hs.length;i<len;i++){
		if(hs[i]&&ps[hs[i]]){
			var pos=ps[hs[i]];
			this[pos]=new Ext.Resizable.Handle(this,pos,this.disableTrackOver,this.transparent);
		}
	}
	this.corner=this.southeast;
	if(this.handles.indexOf('n')!=-1||this.handles.indexOf('w')!=-1){
		this.updateBox=true;
	}
	this.activeHandle=null;
	if(this.resizeChild){
		if(typeof this.resizeChild=='boolean'){
			this.resizeChild=Ext.get(this.el.dom.firstChild,true);
		}else{
			this.resizeChild=Ext.get(this.resizeChild,true);
		}
	}
	if(this.adjustments=='auto'){
		var rc=this.resizeChild;
		var hw=this.west,he=this.east,hn=this.north,hs=this.south;
		if(rc&&(hw||hn)){
			rc.position('relative');
			rc.setLeft(hw?hw.el.getWidth():0);
			rc.setTop(hn?hn.el.getHeight():0);
		}
		this.adjustments=[
			(he?-he.el.getWidth():0)+(hw?-hw.el.getWidth():0),
			(hn?-hn.el.getHeight():0)+(hs?-hs.el.getHeight():0)-1
		];
	}
	if(this.draggable){
		this.dd=this.dynamic?
			this.el.initDD(null):this.el.initDDProxy(null,{dragElId:this.proxy.id});
		this.dd.setHandleElId(this.resizeChild?this.resizeChild.id:this.el.id);
	}
	this.addEvents(
		'beforeresize',
		'resize'
	);
	if(this.width!==null&&this.height!==null){
		this.resizeTo(this.width,this.height);
	}else{
		this.updateChildSize();
	}
	if(Ext.isIE){
		this.el.dom.style.zoom=1;
	}
	Ext.Resizable.superclass.constructor.call(this);};
Ext.extend(Ext.Resizable,Ext.util.Observable,{
	adjustments:[0,0],
	animate:false,
	disableTrackOver:false,
	draggable:false,
	duration:0.35,
	dynamic:false,
	easing:'easeOutStrong',
	enabled:true,
	handles:false,
	multiDirectional:false,
	height:null,
	width:null,
	heightIncrement:0,
	widthIncrement:0,
	minHeight:5,
	minWidth:5,
	maxHeight:10000,
	maxWidth:10000,
	minX:0,
	minY:0,
	pinned:false,
	preserveRatio:false,
	resizeChild:false,
	transparent:false,
	resizeTo:function(width,height){
		this.el.setSize(width,height);
		this.updateChildSize();
		this.fireEvent('resize',this,width,height,null);
	},
	startSizing:function(e,handle){
		this.fireEvent('beforeresize',this,e);
		if(this.enabled){
			if(!this.overlay){
				this.overlay=this.el.createProxy({tag:'div',cls:'x-resizable-overlay',html:'&#160;'},Ext.getBody());
				this.overlay.unselectable();
				this.overlay.enableDisplayMode('block');
				this.overlay.on({
					scope:this,
					mousemove:this.onMouseMove,
					mouseup:this.onMouseUp
				});
			}
			this.overlay.setStyle('cursor',handle.el.getStyle('cursor'));
			this.resizing=true;
			this.startBox=this.el.getBox();
			this.startPoint=e.getXY();
			this.offsets=[(this.startBox.x+this.startBox.width)-this.startPoint[0],
							(this.startBox.y+this.startBox.height)-this.startPoint[1]];
			this.overlay.setSize(Ext.lib.Dom.getViewWidth(true),Ext.lib.Dom.getViewHeight(true));
			this.overlay.show();
			if(this.constrainTo){
				var ct=Ext.get(this.constrainTo);
				this.resizeRegion=ct.getRegion().adjust(
					ct.getFrameWidth('t'),
					ct.getFrameWidth('l'),
					-ct.getFrameWidth('b'),
					-ct.getFrameWidth('r')
				);
			}
			this.proxy.setStyle('visibility','hidden');
			this.proxy.show();
			this.proxy.setBox(this.startBox);
			if(!this.dynamic){
				this.proxy.setStyle('visibility','visible');
			}
		}
	},
	onMouseDown:function(handle,e){
		if(this.enabled){
			e.stopEvent();
			this.activeHandle=handle;
			this.startSizing(e,handle);
		}
	},
	onMouseUp:function(e){
		this.activeHandle=null;
		var size=this.resizeElement();
		this.resizing=false;
		this.handleOut();
		this.overlay.hide();
		this.proxy.hide();
		this.fireEvent('resize',this,size.width,size.height,e);
	},
	updateChildSize:function(){
		if(this.resizeChild){
			var el=this.el;
			var child=this.resizeChild;
			var adj=this.adjustments;
			if(el.dom.offsetWidth){
				var b=el.getSize(true);
				child.setSize(b.width+adj[0],b.height+adj[1]);
			}
			if(Ext.isIE){
				setTimeout(function(){
					if(el.dom.offsetWidth){
						var b=el.getSize(true);
						child.setSize(b.width+adj[0],b.height+adj[1]);
					}
				},10);
			}
		}
	},
	snap:function(value,inc,min){
		if(!inc||!value){
			return value;
		}
		var newValue=value;
		var m=value%inc;
		if(m>0){
			if(m>(inc/2)){
				newValue=value+(inc-m);
			}else{
				newValue=value-m;
			}
		}
		return Math.max(min,newValue);
	},
	resizeElement:function(){
		var box=this.proxy.getBox();
		if(this.updateBox){
			this.el.setBox(box,false,this.animate,this.duration,null,this.easing);
		}else{
			this.el.setSize(box.width,box.height,this.animate,this.duration,null,this.easing);
		}
		this.updateChildSize();
		if(!this.dynamic){
			this.proxy.hide();
		}
		return box;
	},
	constrain:function(v,diff,m,mx){
		if(v-diff<m){
			diff=v-m;
		}else if(v-diff>mx){
			diff=v-mx;
		}
		return diff;
	},
	onMouseMove:function(e){
		if(this.enabled&&this.activeHandle){
			try{
			if(this.resizeRegion&&!this.resizeRegion.contains(e.getPoint())){
				return;
			}
			var curSize=this.curSize||this.startBox,
				x=this.startBox.x,y=this.startBox.y,
				ox=x,
				oy=y,
				w=curSize.width,
				h=curSize.height,
				ow=w,
				oh=h,
				mw=this.minWidth,
				mh=this.minHeight,
				mxw=this.maxWidth,
				mxh=this.maxHeight,
				wi=this.widthIncrement,
				hi=this.heightIncrement,
				eventXY=e.getXY(),
				diffX=-(this.startPoint[0]-Math.max(this.minX,eventXY[0])),
				diffY=-(this.startPoint[1]-Math.max(this.minY,eventXY[1])),
				pos=this.activeHandle.position,
				tw,
				th;
			switch(pos){
				case'east':
					w+=diffX;
					w=Math.min(Math.max(mw,w),mxw);
					break;
				case'south':
					h+=diffY;
					h=Math.min(Math.max(mh,h),mxh);
					break;
				case'southeast':
					w+=diffX;
					h+=diffY;
					w=Math.min(Math.max(mw,w),mxw);
					h=Math.min(Math.max(mh,h),mxh);
					break;
				case'north':
					diffY=this.constrain(h,diffY,mh,mxh);
					y+=diffY;
					h-=diffY;
					break;
				case'west':
					diffX=this.constrain(w,diffX,mw,mxw);
					x+=diffX;
					w-=diffX;
					break;
				case'northeast':
					w+=diffX;
					w=Math.min(Math.max(mw,w),mxw);
					diffY=this.constrain(h,diffY,mh,mxh);
					y+=diffY;
					h-=diffY;
					break;
				case'northwest':
					diffX=this.constrain(w,diffX,mw,mxw);
					diffY=this.constrain(h,diffY,mh,mxh);
					y+=diffY;
					h-=diffY;
					x+=diffX;
					w-=diffX;
					break;
			 case'southwest':
					diffX=this.constrain(w,diffX,mw,mxw);
					h+=diffY;
					h=Math.min(Math.max(mh,h),mxh);
					x+=diffX;
					w-=diffX;
					break;
			}
			var sw=this.snap(w,wi,mw);
			var sh=this.snap(h,hi,mh);
			if(sw!=w||sh!=h){
				switch(pos){
					case'northeast':
						y-=sh-h;
					break;
					case'north':
						y-=sh-h;
						break;
					case'southwest':
						x-=sw-w;
					break;
					case'west':
						x-=sw-w;
						break;
					case'northwest':
						x-=sw-w;
						y-=sh-h;
					break;
				}
				w=sw;
				h=sh;
			}
			if(this.preserveRatio){
				switch(pos){
					case'southeast':
					case'east':
						h=oh*(w/ow);
						h=Math.min(Math.max(mh,h),mxh);
						w=ow*(h/oh);
					 break;
					case'south':
						w=ow*(h/oh);
						w=Math.min(Math.max(mw,w),mxw);
						h=oh*(w/ow);
						break;
					case'northeast':
						w=ow*(h/oh);
						w=Math.min(Math.max(mw,w),mxw);
						h=oh*(w/ow);
					break;
					case'north':
						tw=w;
						w=ow*(h/oh);
						w=Math.min(Math.max(mw,w),mxw);
						h=oh*(w/ow);
						x+=(tw-w)/2;
						break;
					case'southwest':
						h=oh*(w/ow);
						h=Math.min(Math.max(mh,h),mxh);
						tw=w;
						w=ow*(h/oh);
						x+=tw-w;
						break;
					case'west':
						th=h;
						h=oh*(w/ow);
						h=Math.min(Math.max(mh,h),mxh);
						y+=(th-h)/2;
						tw=w;
						w=ow*(h/oh);
						x+=tw-w;
					 break;
					case'northwest':
						tw=w;
						th=h;
						h=oh*(w/ow);
						h=Math.min(Math.max(mh,h),mxh);
						w=ow*(h/oh);
						y+=th-h;
						x+=tw-w;
						break;
				}
			}
			this.proxy.setBounds(x,y,w,h);
			if(this.dynamic){
				this.resizeElement();
			}
			}catch(ex){}
		}
	},
	handleOver:function(){
		if(this.enabled){
			this.el.addClass('x-resizable-over');
		}
	},
	handleOut:function(){
		if(!this.resizing){
			this.el.removeClass('x-resizable-over');
		}
	},
	getEl:function(){
		return this.el;
	},
	getResizeChild:function(){
		return this.resizeChild;
	},
	destroy:function(removeEl){
		Ext.destroy(this.dd,this.overlay,this.proxy);
		this.overlay=null;
		this.proxy=null;
		var ps=Ext.Resizable.positions;
		for(var k in ps){
			if(typeof ps[k]!='function'&&this[ps[k]]){
				this[ps[k]].destroy();
			}
		}
		if(removeEl){
			this.el.update('');
			Ext.destroy(this.el);
			this.el=null;
		}
		this.purgeListeners();
	},
	syncHandleHeight:function(){
		var h=this.el.getHeight(true);
		if(this.west){
			this.west.el.setHeight(h);
		}
		if(this.east){
			this.east.el.setHeight(h);
		}
	}});
Ext.Resizable.positions={
	n:'north',s:'south',e:'east',w:'west',se:'southeast',sw:'southwest',nw:'northwest',ne:'northeast'};
Ext.Resizable.Handle=function(rz,pos,disableTrackOver,transparent){
	if(!this.tpl){
		var tpl=Ext.DomHelper.createTemplate(
			{tag:'div',cls:'x-resizable-handle x-resizable-handle-{0}'}
		);
		tpl.compile();
		Ext.Resizable.Handle.prototype.tpl=tpl;
	}
	this.position=pos;
	this.rz=rz;
	this.el=this.tpl.append(rz.el.dom,[this.position],true);
	this.el.unselectable();
	if(transparent){
		this.el.setOpacity(0);
	}
	this.el.on('mousedown',this.onMouseDown,this);
	if(!disableTrackOver){
		this.el.on({
			scope:this,
			mouseover:this.onMouseOver,
			mouseout:this.onMouseOut
		});
	}};
Ext.Resizable.Handle.prototype={
	afterResize:function(rz){
	},
	onMouseDown:function(e){
		this.rz.onMouseDown(this,e);
	},
	onMouseOver:function(e){
		this.rz.handleOver(this,e);
	},
	onMouseOut:function(e){
		this.rz.handleOut(this,e);
	},
	destroy:function(){
		Ext.destroy(this.el);
		this.el=null;
	}};
Ext.Window=Ext.extend(Ext.Panel,{
	baseCls:'x-window',
	resizable:true,
	draggable:true,
	closable:true,
	closeAction:'close',
	constrain:false,
	constrainHeader:false,
	plain:false,
	minimizable:false,
	maximizable:false,
	minHeight:100,
	minWidth:200,
	expandOnShow:true,
	collapsible:false,
	initHidden:true,
	monitorResize:true,
	elements:'header,body',
	frame:true,
	floating:true,
	initComponent:function(){
		Ext.Window.superclass.initComponent.call(this);
		this.addEvents(
			'resize',
			'maximize',
			'minimize',
			'restore'
		);
		if(this.initHidden===false){
			this.show();
		}else{
			this.hidden=true;
		}
	},
	getState:function(){
		return Ext.apply(Ext.Window.superclass.getState.call(this)||{},this.getBox(true));
	},
	onRender:function(ct,position){
		Ext.Window.superclass.onRender.call(this,ct,position);
		if(this.plain){
			this.el.addClass('x-window-plain');
		}
		this.focusEl=this.el.createChild({
					tag:'a',href:'#',cls:'x-dlg-focus',
					tabIndex:'-1',html:'&#160;'});
		this.focusEl.swallowEvent('click',true);
		this.proxy=this.el.createProxy('x-window-proxy');
		this.proxy.enableDisplayMode('block');
		if(this.modal){
			this.mask=this.container.createChild({cls:'ext-el-mask'},this.el.dom);
			this.mask.enableDisplayMode('block');
			this.mask.hide();
			this.mon(this.mask,'click',this.focus,this);
		}
		this.initTools();
	},
	initEvents:function(){
		Ext.Window.superclass.initEvents.call(this);
		if(this.animateTarget){
			this.setAnimateTarget(this.animateTarget);
		}
		if(this.resizable){
			this.resizer=new Ext.Resizable(this.el,{
				minWidth:this.minWidth,
				minHeight:this.minHeight,
				handles:this.resizeHandles||'all',
				pinned:true,
				resizeElement:this.resizerAction
			});
			this.resizer.window=this;
			this.mon(this.resizer,'beforeresize',this.beforeResize,this);
		}
		if(this.draggable){
			this.header.addClass('x-window-draggable');
		}
		this.mon(this.el,'mousedown',this.toFront,this);
		this.manager=this.manager||Ext.WindowMgr;
		this.manager.register(this);
		if(this.maximized){
			this.maximized=false;
			this.maximize();
		}
		if(this.closable){
			var km=this.getKeyMap();
			km.on(27,this.onEsc,this);
			km.disable();
		}
	},
	initDraggable:function(){
		this.dd=new Ext.Window.DD(this);
	},
	onEsc:function(){
		this[this.closeAction]();
	},
	beforeDestroy:function(){
		if(this.rendered){
			this.hide();
		 if(this.doAnchor){
				Ext.EventManager.removeResizeListener(this.doAnchor,this);
			 Ext.EventManager.un(window,'scroll',this.doAnchor,this);
			}
			Ext.destroy(
				this.focusEl,
				this.resizer,
				this.dd,
				this.proxy,
				this.mask
			);
		}
		Ext.Window.superclass.beforeDestroy.call(this);
	},
	onDestroy:function(){
		if(this.manager){
			this.manager.unregister(this);
		}
		Ext.Window.superclass.onDestroy.call(this);
	},
	initTools:function(){
		if(this.minimizable){
			this.addTool({
				id:'minimize',
				handler:this.minimize.createDelegate(this,[])
			});
		}
		if(this.maximizable){
			this.addTool({
				id:'maximize',
				handler:this.maximize.createDelegate(this,[])
			});
			this.addTool({
				id:'restore',
				handler:this.restore.createDelegate(this,[]),
				hidden:true
			});
			this.mon(this.header,'dblclick',this.toggleMaximize,this);
		}
		if(this.closable){
			this.addTool({
				id:'close',
				handler:this[this.closeAction].createDelegate(this,[])
			});
		}
	},
	resizerAction:function(){
		var box=this.proxy.getBox();
		this.proxy.hide();
		this.window.handleResize(box);
		return box;
	},
	beforeResize:function(){
		this.resizer.minHeight=Math.max(this.minHeight,this.getFrameHeight()+40);
		this.resizer.minWidth=Math.max(this.minWidth,this.getFrameWidth()+40);
		this.resizeBox=this.el.getBox();
	},
	updateHandles:function(){
		if(Ext.isIE&&this.resizer){
			this.resizer.syncHandleHeight();
			this.el.repaint();
		}
	},
	handleResize:function(box){
		var rz=this.resizeBox;
		if(rz.x!=box.x||rz.y!=box.y){
			this.updateBox(box);
		}else{
			this.setSize(box);
		}
		this.focus();
		this.updateHandles();
		this.saveState();
		this.doLayout();
		this.fireEvent('resize',this,box.width,box.height);
	},
	focus:function(){
		var f=this.focusEl,db=this.defaultButton,t=typeof db;
		if(t!='undefined'){
			if(t=='number'&&this.fbar){
				f=this.fbar.items.get(db);
			}else if(t=='string'){
				f=Ext.getCmp(db);
			}else{
				f=db;
			}
		}
		f=f||this.focusEl;
		f.focus.defer(10,f);
	},
	setAnimateTarget:function(el){
		el=Ext.get(el);
		this.animateTarget=el;
	},
	beforeShow:function(){
		delete this.el.lastXY;
		delete this.el.lastLT;
		if(this.x===undefined||this.y===undefined){
			var xy=this.el.getAlignToXY(this.container,'c-c');
			var pos=this.el.translatePoints(xy[0],xy[1]);
			this.x=this.x===undefined?pos.left:this.x;
			this.y=this.y===undefined?pos.top:this.y;
		}
		this.el.setLeftTop(this.x,this.y);
		if(this.expandOnShow){
			this.expand(false);
		}
		if(this.modal){
			Ext.getBody().addClass('x-body-masked');
			this.mask.setSize(Ext.lib.Dom.getViewWidth(true),Ext.lib.Dom.getViewHeight(true));
			this.mask.show();
		}
	},
	show:function(animateTarget,cb,scope){
		if(!this.rendered){
			this.render(Ext.getBody());
		}
		if(this.hidden===false){
			this.toFront();
			return this;
		}
		if(this.fireEvent('beforeshow',this)===false){
			return this;
		}
		if(cb){
			this.on('show',cb,scope,{single:true});
		}
		this.hidden=false;
		if(animateTarget!==undefined){
			this.setAnimateTarget(animateTarget);
		}
		this.beforeShow();
		if(this.animateTarget){
			this.animShow();
		}else{
			this.afterShow();
		}
		return this;
	},
	afterShow:function(isAnim){
		this.proxy.hide();
		this.el.setStyle('display','block');
		this.el.show();
		if(this.maximized){
			this.fitContainer();
		}
		if(Ext.isMac&&Ext.isGecko){
			this.cascade(this.setAutoScroll);
		}
		if(this.monitorResize||this.modal||this.constrain||this.constrainHeader){
			Ext.EventManager.onWindowResize(this.onWindowResize,this);
		}
		this.doConstrain();
		this.doLayout();
		if(this.keyMap){
			this.keyMap.enable();
		}
		this.toFront();
		this.updateHandles();
		if(isAnim&&(Ext.isIE||Ext.isWebKit)){
			var sz=this.getSize();
			this.onResize(sz.width,sz.height);
		}
		this.fireEvent('show',this);
	},
	animShow:function(){
		this.proxy.show();
		this.proxy.setBox(this.animateTarget.getBox());
		this.proxy.setOpacity(0);
		var b=this.getBox(false);
		b.callback=this.afterShow.createDelegate(this,[true],false);
		b.scope=this;
		b.duration=0.25;
		b.easing='easeNone';
		b.opacity=0.5;
		b.block=true;
		this.el.setStyle('display','none');
		this.proxy.shift(b);
	},
	hide:function(animateTarget,cb,scope){
		if(this.hidden||this.fireEvent('beforehide',this)===false){
			return this;
		}
		if(cb){
			this.on('hide',cb,scope,{single:true});
		}
		this.hidden=true;
		if(animateTarget!==undefined){
			this.setAnimateTarget(animateTarget);
		}
		if(this.modal){
			this.mask.hide();
			Ext.getBody().removeClass('x-body-masked');
		}
		if(this.animateTarget){
			this.animHide();
		}else{
			this.el.hide();
			this.afterHide();
		}
		return this;
	},
	afterHide:function(){
		this.proxy.hide();
		if(this.monitorResize||this.modal||this.constrain||this.constrainHeader){
			Ext.EventManager.removeResizeListener(this.onWindowResize,this);
		}
		if(this.keyMap){
			this.keyMap.disable();
		}
		this.fireEvent('hide',this);
	},
	animHide:function(){
		this.proxy.setOpacity(0.5);
		this.proxy.show();
		var tb=this.getBox(false);
		this.proxy.setBox(tb);
		this.el.hide();
		var b=this.animateTarget.getBox();
		b.callback=this.afterHide;
		b.scope=this;
		b.duration=0.25;
		b.easing='easeNone';
		b.block=true;
		b.opacity=0;
		this.proxy.shift(b);
	},
	onWindowResize:function(){
		if(this.maximized){
			this.fitContainer();
		}
		if(this.modal){
			this.mask.setSize('100%','100%');
			var force=this.mask.dom.offsetHeight;
			this.mask.setSize(Ext.lib.Dom.getViewWidth(true),Ext.lib.Dom.getViewHeight(true));
		}
		this.doConstrain();
	},
	doConstrain:function(){
		if(this.constrain||this.constrainHeader){
			var offsets;
			if(this.constrain){
				offsets={
					right:this.el.shadowOffset,
					left:this.el.shadowOffset,
					bottom:this.el.shadowOffset
				};
			}else{
				var s=this.getSize();
				offsets={
					right:-(s.width-100),
					bottom:-(s.height-25)
				};
			}
			var xy=this.el.getConstrainToXY(this.container,true,offsets);
			if(xy){
				this.setPosition(xy[0],xy[1]);
			}
		}
	},
	ghost:function(cls){
		var ghost=this.createGhost(cls);
		var box=this.getBox(true);
		ghost.setLeftTop(box.x,box.y);
		ghost.setWidth(box.width);
		this.el.hide();
		this.activeGhost=ghost;
		return ghost;
	},
	unghost:function(show,matchPosition){
		if(!this.activeGhost){
			return;
		}
		if(show!==false){
			this.el.show();
			this.focus();
			if(Ext.isMac&&Ext.isGecko){
				this.cascade(this.setAutoScroll);
			}
		}
		if(matchPosition!==false){
			this.setPosition(this.activeGhost.getLeft(true),this.activeGhost.getTop(true));
		}
		this.activeGhost.hide();
		this.activeGhost.remove();
		delete this.activeGhost;
	},
	minimize:function(){
		this.fireEvent('minimize',this);
		return this;
	},
	close:function(){
		if(this.fireEvent('beforeclose',this)!==false){
			this.hide(null,function(){
				this.fireEvent('close',this);
				this.destroy();
			},this);
		}
	},
	maximize:function(){
		if(!this.maximized){
			this.expand(false);
			this.restoreSize=this.getSize();
			this.restorePos=this.getPosition(true);
			if(this.maximizable){
				this.tools.maximize.hide();
				this.tools.restore.show();
			}
			this.maximized=true;
			this.el.disableShadow();
			if(this.dd){
				this.dd.lock();
			}
			if(this.collapsible){
				this.tools.toggle.hide();
			}
			this.el.addClass('x-window-maximized');
			this.container.addClass('x-window-maximized-ct');
			this.setPosition(0,0);
			this.fitContainer();
			this.fireEvent('maximize',this);
		}
		return this;
	},
	restore:function(){
		if(this.maximized){
			this.el.removeClass('x-window-maximized');
			this.tools.restore.hide();
			this.tools.maximize.show();
			this.setPosition(this.restorePos[0],this.restorePos[1]);
			this.setSize(this.restoreSize.width,this.restoreSize.height);
			delete this.restorePos;
			delete this.restoreSize;
			this.maximized=false;
			this.el.enableShadow(true);
			if(this.dd){
				this.dd.unlock();
			}
			if(this.collapsible){
				this.tools.toggle.show();
			}
			this.container.removeClass('x-window-maximized-ct');
			this.doConstrain();
			this.fireEvent('restore',this);
		}
		return this;
	},
	toggleMaximize:function(){
		return this[this.maximized?'restore':'maximize']();
	},
	fitContainer:function(){
		var vs=this.container.getViewSize();
		this.setSize(vs.width,vs.height);
	},
	setZIndex:function(index){
		if(this.modal){
			this.mask.setStyle('z-index',index);
		}
		this.el.setZIndex(++index);
		index+=5;
		if(this.resizer){
			this.resizer.proxy.setStyle('z-index',++index);
		}
		this.lastZIndex=index;
	},
	alignTo:function(element,position,offsets){
		var xy=this.el.getAlignToXY(element,position,offsets);
		this.setPagePosition(xy[0],xy[1]);
		return this;
	},
	anchorTo:function(el,alignment,offsets,monitorScroll){
	 if(this.doAnchor){
		 Ext.EventManager.removeResizeListener(this.doAnchor,this);
		 Ext.EventManager.un(window,'scroll',this.doAnchor,this);
	}
	 this.doAnchor=function(){
		 this.alignTo(el,alignment,offsets);
	};
	 Ext.EventManager.onWindowResize(this.doAnchor,this);
	 var tm=typeof monitorScroll;
	 if(tm!='undefined'){
		 Ext.EventManager.on(window,'scroll',this.doAnchor,this,
			{buffer:tm=='number'?monitorScroll:50});
	}
	 this.doAnchor();
	 return this;
	},
	toFront:function(e){
		if(this.manager.bringToFront(this)){
			if(!e||!e.getTarget().focus){
				this.focus();
			}
		}
		return this;
	},
	setActive:function(active){
		if(active){
			if(!this.maximized){
				this.el.enableShadow(true);
			}
			this.fireEvent('activate',this);
		}else{
			this.el.disableShadow();
			this.fireEvent('deactivate',this);
		}
	},
	toBack:function(){
		this.manager.sendToBack(this);
		return this;
	},
	center:function(){
		var xy=this.el.getAlignToXY(this.container,'c-c');
		this.setPagePosition(xy[0],xy[1]);
		return this;
	}
	});
Ext.reg('window',Ext.Window);
Ext.Window.DD=function(win){
	this.win=win;
	Ext.Window.DD.superclass.constructor.call(this,win.el.id,'WindowDD-'+win.id);
	this.setHandleElId(win.header.id);
	this.scroll=false;};
Ext.extend(Ext.Window.DD,Ext.dd.DD,{
	moveOnly:true,
	headerOffsets:[100,25],
	startDrag:function(){
		var w=this.win;
		this.proxy=w.ghost();
		if(w.constrain!==false){
			var so=w.el.shadowOffset;
			this.constrainTo(w.container,{right:so,left:so,bottom:so});
		}else if(w.constrainHeader!==false){
			var s=this.proxy.getSize();
			this.constrainTo(w.container,{right:-(s.width-this.headerOffsets[0]),bottom:-(s.height-this.headerOffsets[1])});
		}
	},
	b4Drag:Ext.emptyFn,
	onDrag:function(e){
		this.alignElWithMouse(this.proxy,e.getPageX(),e.getPageY());
	},
	endDrag:function(e){
		this.win.unghost();
		this.win.saveState();
	}});
Ext.WindowGroup=function(){
	var list={};
	var accessList=[];
	var front=null;
	var sortWindows=function(d1,d2){
		return(!d1._lastAccess||d1._lastAccess<d2._lastAccess)?-1:1;
	};
	var orderWindows=function(){
		var a=accessList,len=a.length;
		if(len>0){
			a.sort(sortWindows);
			var seed=a[0].manager.zseed;
			for(var i=0;i<len;i++){
				var win=a[i];
				if(win&&!win.hidden){
					win.setZIndex(seed+(i*10));
				}
			}
		}
		activateLast();
	};
	var setActiveWin=function(win){
		if(win!=front){
			if(front){
				front.setActive(false);
			}
			front=win;
			if(win){
				win.setActive(true);
			}
		}
	};
	var activateLast=function(){
		for(var i=accessList.length-1;i>=0;--i){
			if(!accessList[i].hidden){
				setActiveWin(accessList[i]);
				return;
			}
		}
		setActiveWin(null);
	};
	return{
		zseed:9000,
		register:function(win){
			list[win.id]=win;
			accessList.push(win);
			win.on('hide',activateLast);
		},
		unregister:function(win){
			delete list[win.id];
			win.un('hide',activateLast);
			accessList.remove(win);
		},
		get:function(id){
			return typeof id=="object"?id:list[id];
		},
		bringToFront:function(win){
			win=this.get(win);
			if(win!=front){
				win._lastAccess=new Date().getTime();
				orderWindows();
				return true;
			}
			return false;
		},
		sendToBack:function(win){
			win=this.get(win);
			win._lastAccess=-(new Date().getTime());
			orderWindows();
			return win;
		},
		hideAll:function(){
			for(var id in list){
				if(list[id]&&typeof list[id]!="function"&&list[id].isVisible()){
					list[id].hide();
				}
			}
		},
		getActive:function(){
			return front;
		},
		getBy:function(fn,scope){
			var r=[];
			for(var i=accessList.length-1;i>=0;--i){
				var win=accessList[i];
				if(fn.call(scope||win,win)!==false){
					r.push(win);
				}
			}
			return r;
		},
		each:function(fn,scope){
			for(var id in list){
				if(list[id]&&typeof list[id]!="function"){
					if(fn.call(scope||list[id],list[id])===false){
						return;
					}
				}
			}
		}
	};};
Ext.WindowMgr=new Ext.WindowGroup();
Ext.MessageBox=function(){
	var dlg,opt,mask,waitTimer;
	var bodyEl,msgEl,textboxEl,textareaEl,progressBar,pp,iconEl,spacerEl;
	var buttons,activeTextEl,bwidth,iconCls='';
	var handleButton=function(button){
		if(dlg.isVisible()){
			dlg.hide();
			handleHide();
			Ext.callback(opt.fn,opt.scope||window,[button,activeTextEl.dom.value,opt],1);
		}
	};
	var handleHide=function(){
		if(opt&&opt.cls){
			dlg.el.removeClass(opt.cls);
		}
		progressBar.reset();
	};
	var handleEsc=function(d,k,e){
		if(opt&&opt.closable!==false){
			dlg.hide();
			handleHide();
		}
		if(e){
			e.stopEvent();
		}
	};
	var updateButtons=function(b){
		var width=0;
		if(!b){
			buttons["ok"].hide();
			buttons["cancel"].hide();
			buttons["yes"].hide();
			buttons["no"].hide();
			return width;
		}
		dlg.footer.dom.style.display='';
		for(var k in buttons){
			if(typeof buttons[k]!="function"){
				if(b[k]){
					buttons[k].show();
					buttons[k].setText(typeof b[k]=="string"?b[k]:Ext.MessageBox.buttonText[k]);
					width+=buttons[k].el.getWidth()+15;
				}else{
					buttons[k].hide();
				}
			}
		}
		return width;
	};
	return{
		getDialog:function(titleText){
		 if(!dlg){
				dlg=new Ext.Window({
					autoCreate:true,
					title:titleText,
					resizable:false,
					constrain:true,
					constrainHeader:true,
					minimizable:false,
					maximizable:false,
					stateful:false,
					modal:true,
					shim:true,
					buttonAlign:"center",
					width:400,
					height:100,
					minHeight:80,
					plain:true,
					footer:true,
					closable:true,
					close:function(){
						if(opt&&opt.buttons&&opt.buttons.no&&!opt.buttons.cancel){
							handleButton("no");
						}else{
							handleButton("cancel");
						}
					}
				});
				buttons={};
				var bt=this.buttonText;
				buttons["ok"]=dlg.addButton(bt["ok"],handleButton.createCallback("ok"));
				buttons["yes"]=dlg.addButton(bt["yes"],handleButton.createCallback("yes"));
				buttons["no"]=dlg.addButton(bt["no"],handleButton.createCallback("no"));
				buttons["cancel"]=dlg.addButton(bt["cancel"],handleButton.createCallback("cancel"));
				buttons["ok"].hideMode=buttons["yes"].hideMode=buttons["no"].hideMode=buttons["cancel"].hideMode='offsets';
				dlg.render(document.body);
				dlg.getEl().addClass('x-window-dlg');
				mask=dlg.mask;
				bodyEl=dlg.body.createChild({
					html:'<div class="ext-mb-icon"></div><div class="ext-mb-content"><span class="ext-mb-text"></span><br /><div class="ext-mb-fix-cursor"><input type="text" class="ext-mb-input" /><textarea class="ext-mb-textarea"></textarea></div></div>'
				});
				iconEl=Ext.get(bodyEl.dom.firstChild);
				var contentEl=bodyEl.dom.childNodes[1];
				msgEl=Ext.get(contentEl.firstChild);
				textboxEl=Ext.get(contentEl.childNodes[2].firstChild);
				textboxEl.enableDisplayMode();
				textboxEl.addKeyListener([10,13],function(){
					if(dlg.isVisible()&&opt&&opt.buttons){
						if(opt.buttons.ok){
							handleButton("ok");
						}else if(opt.buttons.yes){
							handleButton("yes");
						}
					}
				});
				textareaEl=Ext.get(contentEl.childNodes[2].childNodes[1]);
				textareaEl.enableDisplayMode();
				progressBar=new Ext.ProgressBar({
					renderTo:bodyEl
				});
			 bodyEl.createChild({cls:'x-clear'});
			}
			return dlg;
		},
		updateText:function(text){
			if(!dlg.isVisible()&&!opt.width){
				dlg.setSize(this.maxWidth,100);
			}
			msgEl.update(text||'&#160;');
			var iw=iconCls!=''?(iconEl.getWidth()+iconEl.getMargins('lr')):0;
			var mw=msgEl.getWidth()+msgEl.getMargins('lr');
			var fw=dlg.getFrameWidth('lr');
			var bw=dlg.body.getFrameWidth('lr');
			if(Ext.isIE&&iw>0){
				iw+=3;
			}
			var w=Math.max(Math.min(opt.width||iw+mw+fw+bw,this.maxWidth),
						Math.max(opt.minWidth||this.minWidth,bwidth||0));
			if(opt.prompt===true){
				activeTextEl.setWidth(w-iw-fw-bw);
			}
			if(opt.progress===true||opt.wait===true){
				progressBar.setSize(w-iw-fw-bw);
			}
			if(Ext.isIE&&w==bwidth){
				w+=4;
			}
			dlg.setSize(w,'auto').center();
			return this;
		},
		updateProgress:function(value,progressText,msg){
			progressBar.updateProgress(value,progressText);
			if(msg){
				this.updateText(msg);
			}
			return this;
		},
		isVisible:function(){
			return dlg&&dlg.isVisible();
		},
		hide:function(){
			var proxy=dlg?dlg.activeGhost:null;
			if(this.isVisible()||proxy){
				dlg.hide();
				handleHide();
				if(proxy){
					dlg.unghost(false,false);
				}
			}
			return this;
		},
		show:function(options){
			if(this.isVisible()){
				this.hide();
			}
			opt=options;
			var d=this.getDialog(opt.title||"&#160;");
			d.setTitle(opt.title||"&#160;");
			var allowClose=(opt.closable!==false&&opt.progress!==true&&opt.wait!==true);
			d.tools.close.setDisplayed(allowClose);
			activeTextEl=textboxEl;
			opt.prompt=opt.prompt||(opt.multiline?true:false);
			if(opt.prompt){
				if(opt.multiline){
					textboxEl.hide();
					textareaEl.show();
					textareaEl.setHeight(typeof opt.multiline=="number"?
						opt.multiline:this.defaultTextHeight);
					activeTextEl=textareaEl;
				}else{
					textboxEl.show();
					textareaEl.hide();
				}
			}else{
				textboxEl.hide();
				textareaEl.hide();
			}
			activeTextEl.dom.value=opt.value||"";
			if(opt.prompt){
				d.focusEl=activeTextEl;
			}else{
				var bs=opt.buttons;
				var db=null;
				if(bs&&bs.ok){
					db=buttons["ok"];
				}else if(bs&&bs.yes){
					db=buttons["yes"];
				}
				if(db){
					d.focusEl=db;
				}
			}
			if(opt.iconCls){
			 d.setIconClass(opt.iconCls);
			}
			this.setIcon(opt.icon);
			if(opt.cls){
				d.el.addClass(opt.cls);
			}
			d.proxyDrag=opt.proxyDrag===true;
			d.modal=opt.modal!==false;
			d.mask=opt.modal!==false?mask:false;
			d.on('show',function(){
				d.keyMap.setDisabled(allowClose!==true);
				d.doLayout();
				this.setIcon(opt.icon);
				bwidth=updateButtons(opt.buttons);
				progressBar.setVisible(opt.progress===true||opt.wait===true);
				this.updateProgress(0,opt.progressText);
				this.updateText(opt.msg);
				if(opt.wait===true){
					progressBar.wait(opt.waitConfig);
				}
			},this,{single:true});
			if(!d.isVisible()){
				document.body.appendChild(dlg.el.dom);
				d.setAnimateTarget(opt.animEl);
				d.show(opt.animEl);
			}
			return this;
		},
		setIcon:function(icon){
			if(icon&&icon!=''){
				iconEl.removeClass('x-hidden');
				iconEl.replaceClass(iconCls,icon);
				bodyEl.addClass('x-dlg-icon');
				iconCls=icon;
			}else{
				iconEl.replaceClass(iconCls,'x-hidden');
				bodyEl.removeClass('x-dlg-icon');
				iconCls='';
			}
			return this;
		},
		progress:function(title,msg,progressText){
			this.show({
				title:title,
				msg:msg,
				buttons:false,
				progress:true,
				closable:false,
				minWidth:this.minProgressWidth,
				progressText:progressText
			});
			return this;
		},
		wait:function(msg,title,config){
			this.show({
				title:title,
				msg:msg,
				buttons:false,
				closable:false,
				wait:true,
				modal:true,
				minWidth:this.minProgressWidth,
				waitConfig:config
			});
			return this;
		},
		alert:function(title,msg,fn,scope){
			this.show({
				title:title,
				msg:msg,
				buttons:this.OK,
				fn:fn,
				scope:scope
			});
			return this;
		},
		confirm:function(title,msg,fn,scope){
			this.show({
				title:title,
				msg:msg,
				buttons:this.YESNO,
				fn:fn,
				scope:scope,
				icon:this.QUESTION
			});
			return this;
		},
		prompt:function(title,msg,fn,scope,multiline,value){
			this.show({
				title:title,
				msg:msg,
				buttons:this.OKCANCEL,
				fn:fn,
				minWidth:250,
				scope:scope,
				prompt:true,
				multiline:multiline,
				value:value
			});
			return this;
		},
		OK:{ok:true},
		CANCEL:{cancel:true},
		OKCANCEL:{ok:true,cancel:true},
		YESNO:{yes:true,no:true},
		YESNOCANCEL:{yes:true,no:true,cancel:true},
		INFO:'ext-mb-info',
		WARNING:'ext-mb-warning',
		QUESTION:'ext-mb-question',
		ERROR:'ext-mb-error',
		defaultTextHeight:75,
		maxWidth:600,
		minWidth:110,
		minProgressWidth:250,
		buttonText:{
			ok:"OK",
			cancel:"Cancel",
			yes:"Yes",
			no:"No"
		}
	};}();
Ext.Msg=Ext.MessageBox;
Ext.dd.PanelProxy=function(panel,config){
	this.panel=panel;
	this.id=this.panel.id+'-ddproxy';
	Ext.apply(this,config);};
Ext.dd.PanelProxy.prototype={
	insertProxy:true,
	setStatus:Ext.emptyFn,
	reset:Ext.emptyFn,
	update:Ext.emptyFn,
	stop:Ext.emptyFn,
	sync:Ext.emptyFn,
	getEl:function(){
		return this.ghost;
	},
	getGhost:function(){
		return this.ghost;
	},
	getProxy:function(){
		return this.proxy;
	},
	hide:function(){
		if(this.ghost){
			if(this.proxy){
				this.proxy.remove();
				delete this.proxy;
			}
			this.panel.el.dom.style.display='';
			this.ghost.remove();
			delete this.ghost;
		}
	},
	show:function(){
		if(!this.ghost){
			this.ghost=this.panel.createGhost(undefined,undefined,Ext.getBody());
			this.ghost.setXY(this.panel.el.getXY())
			if(this.insertProxy){
				this.proxy=this.panel.el.insertSibling({cls:'x-panel-dd-spacer'});
				this.proxy.setSize(this.panel.getSize());
			}
			this.panel.el.dom.style.display='none';
		}
	},
	repair:function(xy,callback,scope){
		this.hide();
		if(typeof callback=="function"){
			callback.call(scope||this);
		}
	},
	moveProxy:function(parentNode,before){
		if(this.proxy){
			parentNode.insertBefore(this.proxy.dom,before);
		}
	}};
Ext.Panel.DD=function(panel,cfg){
	this.panel=panel;
	this.dragData={panel:panel};
	this.proxy=new Ext.dd.PanelProxy(panel,cfg);
	Ext.Panel.DD.superclass.constructor.call(this,panel.el,cfg);
	var h=panel.header;
	if(h){
		this.setHandleElId(h.id);
	}
	(h?h:this.panel.body).setStyle('cursor','move');
	this.scroll=false;};
Ext.extend(Ext.Panel.DD,Ext.dd.DragSource,{
	showFrame:Ext.emptyFn,
	startDrag:Ext.emptyFn,
	b4StartDrag:function(x,y){
		this.proxy.show();
	},
	b4MouseDown:function(e){
		var x=e.getPageX();
		var y=e.getPageY();
		this.autoOffset(x,y);
	},
	onInitDrag:function(x,y){
		this.onStartDrag(x,y);
		return true;
	},
	createFrame:Ext.emptyFn,
	getDragEl:function(e){
		return this.proxy.ghost.dom;
	},
	endDrag:function(e){
		this.proxy.hide();
		this.panel.saveState();
	},
	autoOffset:function(x,y){
		x-=this.startPageX;
		y-=this.startPageY;
		this.setDelta(x,y);
	}});
Ext.state.Provider=function(){
	this.addEvents("statechange");
	this.state={};
	Ext.state.Provider.superclass.constructor.call(this);};
Ext.extend(Ext.state.Provider,Ext.util.Observable,{
	get:function(name,defaultValue){
		return typeof this.state[name]=="undefined"?
			defaultValue:this.state[name];
	},
	clear:function(name){
		delete this.state[name];
		this.fireEvent("statechange",this,name,null);
	},
	set:function(name,value){
		this.state[name]=value;
		this.fireEvent("statechange",this,name,value);
	},
	decodeValue:function(cookie){
		var re=/^(a|n|d|b|s|o)\:(.*)$/;
		var matches=re.exec(unescape(cookie));
		if(!matches||!matches[1])return;
		var type=matches[1];
		var v=matches[2];
		switch(type){
			case"n":
				return parseFloat(v);
			case"d":
				return new Date(Date.parse(v));
			case"b":
				return(v=="1");
			case"a":
				var all=[];
				var values=v.split("^");
				for(var i=0,len=values.length;i<len;i++){
					all.push(this.decodeValue(values[i]));
				}
				return all;
		 case"o":
				var all={};
				var values=v.split("^");
				for(var i=0,len=values.length;i<len;i++){
					var kv=values[i].split("=");
					all[kv[0]]=this.decodeValue(kv[1]);
				}
				return all;
		 default:
				return v;
		}
	},
	encodeValue:function(v){
		var enc;
		if(typeof v=="number"){
			enc="n:"+v;
		}else if(typeof v=="boolean"){
			enc="b:"+(v?"1":"0");
		}else if(Ext.isDate(v)){
			enc="d:"+v.toGMTString();
		}else if(Ext.isArray(v)){
			var flat="";
			for(var i=0,len=v.length;i<len;i++){
				flat+=this.encodeValue(v[i]);
				if(i!=len-1)flat+="^";
			}
			enc="a:"+flat;
		}else if(typeof v=="object"){
			var flat="";
			for(var key in v){
				if(typeof v[key]!="function"&&v[key]!==undefined){
					flat+=key+"="+this.encodeValue(v[key])+"^";
				}
			}
			enc="o:"+flat.substring(0,flat.length-1);
		}else{
			enc="s:"+v;
		}
		return escape(enc);
	}});
Ext.state.Manager=function(){
	var provider=new Ext.state.Provider();
	return{
		setProvider:function(stateProvider){
			provider=stateProvider;
		},
		get:function(key,defaultValue){
			return provider.get(key,defaultValue);
		},
		 set:function(key,value){
			provider.set(key,value);
		},
		clear:function(key){
			provider.clear(key);
		},
		getProvider:function(){
			return provider;
		}
	};}();
Ext.state.CookieProvider=function(config){
	Ext.state.CookieProvider.superclass.constructor.call(this);
	this.path="/";
	this.expires=new Date(new Date().getTime()+(1000*60*60*24*7));
	this.domain=null;
	this.secure=false;
	Ext.apply(this,config);
	this.state=this.readCookies();};
Ext.extend(Ext.state.CookieProvider,Ext.state.Provider,{
	set:function(name,value){
		if(typeof value=="undefined"||value===null){
			this.clear(name);
			return;
		}
		this.setCookie(name,value);
		Ext.state.CookieProvider.superclass.set.call(this,name,value);
	},
	clear:function(name){
		this.clearCookie(name);
		Ext.state.CookieProvider.superclass.clear.call(this,name);
	},
	readCookies:function(){
		var cookies={};
		var c=document.cookie+";";
		var re=/\s?(.*?)=(.*?);/g;
		var matches;
		while((matches=re.exec(c))!=null){
			var name=matches[1];
			var value=matches[2];
			if(name&&name.substring(0,3)=="ys-"){
				cookies[name.substr(3)]=this.decodeValue(value);
			}
		}
		return cookies;
	},
	setCookie:function(name,value){
		document.cookie="ys-"+name+"="+this.encodeValue(value)+
		((this.expires==null)?"":("; expires="+this.expires.toGMTString()))+
		((this.path==null)?"":("; path="+this.path))+
		((this.domain==null)?"":("; domain="+this.domain))+
		((this.secure==true)?"; secure":"");
	},
	clearCookie:function(name){
		document.cookie="ys-"+name+"=null; expires=Thu, 01-Jan-70 00:00:01 GMT"+
		((this.path==null)?"":("; path="+this.path))+
		((this.domain==null)?"":("; domain="+this.domain))+
		((this.secure==true)?"; secure":"");
	}});
Ext.DataView=Ext.extend(Ext.BoxComponent,{
	selectedClass:"x-view-selected",
	emptyText:"",
	deferEmptyText:true,
	trackOver:false,
	last:false,
	initComponent:function(){
		Ext.DataView.superclass.initComponent.call(this);
		if(Ext.isString(this.tpl)||Ext.isArray(this.tpl)){
			this.tpl=new Ext.XTemplate(this.tpl);
		}
		this.addEvents(
			"beforeclick",
			"click",
			"mouseenter",
			"mouseleave",
			"containerclick",
			"dblclick",
			"contextmenu",
			"containercontextmenu",
			"selectionchange",
			"beforeselect"
		);
		this.store=Ext.StoreMgr.lookup(this.store);
		this.all=new Ext.CompositeElementLite();
		this.selected=new Ext.CompositeElementLite();
	},
	afterRender:function(){
		Ext.DataView.superclass.afterRender.call(this);
		this.mon(this.getTemplateTarget(),{
			"click":this.onClick,
			"dblclick":this.onDblClick,
			"contextmenu":this.onContextMenu,
			scope:this
		});
		if(this.overClass||this.trackOver){
			this.mon(this.getTemplateTarget(),{
				"mouseover":this.onMouseOver,
				"mouseout":this.onMouseOut,
				scope:this
			});
		}
		if(this.store){
			this.bindStore(this.store,true);
		}
	},
	refresh:function(){
		this.clearSelections(false,true);
		var el=this.getTemplateTarget();
		el.update("");
		var records=this.store.getRange();
		if(records.length<1){
			if(!this.deferEmptyText||this.hasSkippedEmptyText){
				el.update(this.emptyText);
			}
			this.all.clear();
		}else{
			this.tpl.overwrite(el,this.collectData(records,0));
			this.all.fill(Ext.query(this.itemSelector,el.dom));
			this.updateIndexes(0);
		}
		this.hasSkippedEmptyText=true;
	},
	getTemplateTarget:function(){
		return this.el;
	},
	prepareData:function(data){
		return data;
	},
	collectData:function(records,startIndex){
		var r=[];
		for(var i=0,len=records.length;i<len;i++){
			r[r.length]=this.prepareData(records[i].data,startIndex+i,records[i]);
		}
		return r;
	},
	bufferRender:function(records){
		var div=document.createElement('div');
		this.tpl.overwrite(div,this.collectData(records));
		return Ext.query(this.itemSelector,div);
	},
	onUpdate:function(ds,record){
		var index=this.store.indexOf(record);
		var sel=this.isSelected(index);
		var original=this.all.elements[index];
		var node=this.bufferRender([record],index)[0];
		this.all.replaceElement(index,node,true);
		if(sel){
			this.selected.replaceElement(original,node);
			this.all.item(index).addClass(this.selectedClass);
		}
		this.updateIndexes(index,index);
	},
	onAdd:function(ds,records,index){
		if(this.all.getCount()===0){
			this.refresh();
			return;
		}
		var nodes=this.bufferRender(records,index),n,a=this.all.elements;
		if(index<this.all.getCount()){
			n=this.all.item(index).insertSibling(nodes,'before',true);
			a.splice.apply(a,[index,0].concat(nodes));
		}else{
			n=this.all.last().insertSibling(nodes,'after',true);
			a.push.apply(a,nodes);
		}
		this.updateIndexes(index);
	},
	onRemove:function(ds,record,index){
		this.deselect(index);
		this.all.removeElement(index,true);
		this.updateIndexes(index);
		if(this.store.getCount()===0){
			this.refresh();
		}
	},
	refreshNode:function(index){
		this.onUpdate(this.store,this.store.getAt(index));
	},
	updateIndexes:function(startIndex,endIndex){
		var ns=this.all.elements;
		startIndex=startIndex||0;
		endIndex=endIndex||((endIndex===0)?0:(ns.length-1));
		for(var i=startIndex;i<=endIndex;i++){
			ns[i].viewIndex=i;
		}
	},
	getStore:function(){
		return this.store;
	},
	bindStore:function(store,initial){
		if(!initial&&this.store){
			this.store.un("beforeload",this.onBeforeLoad,this);
			this.store.un("datachanged",this.refresh,this);
			this.store.un("add",this.onAdd,this);
			this.store.un("remove",this.onRemove,this);
			this.store.un("update",this.onUpdate,this);
			this.store.un("clear",this.refresh,this);
			if(store!==this.store&&this.store.autoDestroy){
				this.store.destroy();
			}
		}
		if(store){
			store=Ext.StoreMgr.lookup(store);
			store.on({
				scope:this,
				beforeload:this.onBeforeLoad,
				datachanged:this.refresh,
				add:this.onAdd,
				remove:this.onRemove,
				update:this.onUpdate,
				clear:this.refresh
			});
		}
		this.store=store;
		if(store){
			this.refresh();
		}
	},
	findItemFromChild:function(node){
		return Ext.fly(node).findParent(this.itemSelector,this.getTemplateTarget());
	},
	onClick:function(e){
		var item=e.getTarget(this.itemSelector,this.getTemplateTarget());
		if(item){
			var index=this.indexOf(item);
			if(this.onItemClick(item,index,e)!==false){
				this.fireEvent("click",this,index,item,e);
			}
		}else{
			if(this.fireEvent("containerclick",this,e)!==false){
				this.onContainerClick(e);
			}
		}
	},
	onContainerClick:function(e){
		this.clearSelections();
	},
	onContextMenu:function(e){
		var item=e.getTarget(this.itemSelector,this.getTemplateTarget());
		if(item){
			this.fireEvent("contextmenu",this,this.indexOf(item),item,e);
		}else{
			this.fireEvent("containercontextmenu",this,e);
		}
	},
	onDblClick:function(e){
		var item=e.getTarget(this.itemSelector,this.getTemplateTarget());
		if(item){
			this.fireEvent("dblclick",this,this.indexOf(item),item,e);
		}
	},
	onMouseOver:function(e){
		var item=e.getTarget(this.itemSelector,this.getTemplateTarget());
		if(item&&item!==this.lastItem){
			this.lastItem=item;
			Ext.fly(item).addClass(this.overClass);
			this.fireEvent("mouseenter",this,this.indexOf(item),item,e);
		}
	},
	onMouseOut:function(e){
		if(this.lastItem){
			if(!e.within(this.lastItem,true,true)){
				Ext.fly(this.lastItem).removeClass(this.overClass);
				this.fireEvent("mouseleave",this,this.indexOf(this.lastItem),this.lastItem,e);
				delete this.lastItem;
			}
		}
	},
	onItemClick:function(item,index,e){
		if(this.fireEvent("beforeclick",this,index,item,e)===false){
			return false;
		}
		if(this.multiSelect){
			this.doMultiSelection(item,index,e);
			e.preventDefault();
		}else if(this.singleSelect){
			this.doSingleSelection(item,index,e);
			e.preventDefault();
		}
		return true;
	},
	doSingleSelection:function(item,index,e){
		if(e.ctrlKey&&this.isSelected(index)){
			this.deselect(index);
		}else{
			this.select(index,false);
		}
	},
	doMultiSelection:function(item,index,e){
		if(e.shiftKey&&this.last!==false){
			var last=this.last;
			this.selectRange(last,index,e.ctrlKey);
			this.last=last;
		}else{
			if((e.ctrlKey||this.simpleSelect)&&this.isSelected(index)){
				this.deselect(index);
			}else{
				this.select(index,e.ctrlKey||e.shiftKey||this.simpleSelect);
			}
		}
	},
	getSelectionCount:function(){
		return this.selected.getCount();
	},
	getSelectedNodes:function(){
		return this.selected.elements;
	},
	getSelectedIndexes:function(){
		var indexes=[],s=this.selected.elements;
		for(var i=0,len=s.length;i<len;i++){
			indexes.push(s[i].viewIndex);
		}
		return indexes;
	},
	getSelectedRecords:function(){
		var r=[],s=this.selected.elements;
		for(var i=0,len=s.length;i<len;i++){
			r[r.length]=this.store.getAt(s[i].viewIndex);
		}
		return r;
	},
	getRecords:function(nodes){
		var r=[],s=nodes;
		for(var i=0,len=s.length;i<len;i++){
			r[r.length]=this.store.getAt(s[i].viewIndex);
		}
		return r;
	},
	getRecord:function(node){
		return this.store.getAt(node.viewIndex);
	},
	clearSelections:function(suppressEvent,skipUpdate){
		if((this.multiSelect||this.singleSelect)&&this.selected.getCount()>0){
			if(!skipUpdate){
				this.selected.removeClass(this.selectedClass);
			}
			this.selected.clear();
			this.last=false;
			if(!suppressEvent){
				this.fireEvent("selectionchange",this,this.selected.elements);
			}
		}
	},
	isSelected:function(node){
		return this.selected.contains(this.getNode(node));
	},
	deselect:function(node){
		if(this.isSelected(node)){
			node=this.getNode(node);
			this.selected.removeElement(node);
			if(this.last==node.viewIndex){
				this.last=false;
			}
			Ext.fly(node).removeClass(this.selectedClass);
			this.fireEvent("selectionchange",this,this.selected.elements);
		}
	},
	select:function(nodeInfo,keepExisting,suppressEvent){
		if(Ext.isArray(nodeInfo)){
			if(!keepExisting){
				this.clearSelections(true);
			}
			for(var i=0,len=nodeInfo.length;i<len;i++){
				this.select(nodeInfo[i],true,true);
			}
			if(!suppressEvent){
				this.fireEvent("selectionchange",this,this.selected.elements);
			}
		}else{
			var node=this.getNode(nodeInfo);
			if(!keepExisting){
				this.clearSelections(true);
			}
			if(node&&!this.isSelected(node)){
				if(this.fireEvent("beforeselect",this,node,this.selected.elements)!==false){
					Ext.fly(node).addClass(this.selectedClass);
					this.selected.add(node);
					this.last=node.viewIndex;
					if(!suppressEvent){
						this.fireEvent("selectionchange",this,this.selected.elements);
					}
				}
			}
		}
	},
	selectRange:function(start,end,keepExisting){
		if(!keepExisting){
			this.clearSelections(true);
		}
		this.select(this.getNodes(start,end),true);
	},
	getNode:function(nodeInfo){
		if(Ext.isString(nodeInfo)){
			return document.getElementById(nodeInfo);
		}else if(Ext.isNumber(nodeInfo)){
			return this.all.elements[nodeInfo];
		}
		return nodeInfo;
	},
	getNodes:function(start,end){
		var ns=this.all.elements;
		start=start||0;
		end=!Ext.isDefined(end)?Math.max(ns.length-1,0):end;
		var nodes=[],i;
		if(start<=end){
			for(i=start;i<=end&&ns[i];i++){
				nodes.push(ns[i]);
			}
		}else{
			for(i=start;i>=end&&ns[i];i--){
				nodes.push(ns[i]);
			}
		}
		return nodes;
	},
	indexOf:function(node){
		node=this.getNode(node);
		if(Ext.isNumber(node.viewIndex)){
			return node.viewIndex;
		}
		return this.all.indexOf(node);
	},
	onBeforeLoad:function(){
		if(this.loadingText){
			this.clearSelections(false,true);
			this.getTemplateTarget().update('<div class="loading-indicator">'+this.loadingText+'</div>');
			this.all.clear();
		}
	},
	onDestroy:function(){
		Ext.DataView.superclass.onDestroy.call(this);
		this.bindStore(null);
	}});
Ext.DataView.prototype.setStore=Ext.DataView.prototype.bindStore;
Ext.reg('dataview',Ext.DataView);
Ext.ListView=Ext.extend(Ext.DataView,{
	itemSelector:'dl',
	selectedClass:'x-list-selected',
	overClass:'x-list-over',
	scrollOffset:19,
	columnResize:true,
	columnSort:true,
	initComponent:function(){
		if(this.columnResize){
			this.colResizer=new Ext.ListView.ColumnResizer(this.colResizer);
			this.colResizer.init(this);
		}
		if(this.columnSort){
			this.colSorter=new Ext.ListView.Sorter(this.columnSort);
			this.colSorter.init(this);
		}
		if(!this.internalTpl){
			this.internalTpl=new Ext.XTemplate(
				'<div class="x-list-header"><div class="x-list-header-inner">',
					'<tpl for="columns">',
					'<div style="width:{width}%;text-align:{align};"><em unselectable="on" id="',this.id,'-xlhd-{#}">',
						'{header}',
					'</em></div>',
					'</tpl>',
					'<div class="x-clear"></div>',
				'</div></div>',
				'<div class="x-list-body"><div class="x-list-body-inner">',
				'</div></div>'
			);
		}
		if(!this.tpl){
			this.tpl=new Ext.XTemplate(
				'<tpl for="rows">',
					'<dl>',
						'<tpl for="parent.columns">',
						'<dt style="width:{width}%;text-align:{align};"><em unselectable="on">',
							'{[values.tpl.apply(parent)]}',
						'</em></dt>',
						'</tpl>',
						'<div class="x-clear"></div>',
					'</dl>',
				'</tpl>'
			);
		};
		var cs=this.columns,allocatedWidth=0,colsWithWidth=0,len=cs.length;
		for(var i=0;i<len;i++){
			var c=cs[i];
			if(!c.tpl){
				c.tpl=new Ext.XTemplate('{'+c.dataIndex+'}');
			}else if(Ext.isString(c.tpl)){
				c.tpl=new Ext.XTemplate(c.tpl);
			}
			c.align=c.align||'left';
			if(Ext.isNumber(c.width)){
				c.width*=100;
				allocatedWidth+=c.width;
				colsWithWidth++;
			}
		}
		if(colsWithWidth<len){
			var remaining=len-colsWithWidth;
			if(allocatedWidth<100){
				var perCol=((100-allocatedWidth)/remaining);
				for(var j=0;j<len;j++){
					var c=cs[j];
					if(!Ext.isNumber(c.width)){
						c.width=perCol;
					}
				}
			}
		}
		Ext.ListView.superclass.initComponent.call(this);
	},
	onRender:function(){
		Ext.ListView.superclass.onRender.apply(this,arguments);
		this.internalTpl.overwrite(this.el,{columns:this.columns});
		this.innerBody=Ext.get(this.el.dom.childNodes[1].firstChild);
		this.innerHd=Ext.get(this.el.dom.firstChild.firstChild);
		if(this.hideHeaders){
			this.el.dom.firstChild.style.display='none';
		}
	},
	getTemplateTarget:function(){
		return this.innerBody;
	},
	collectData:function(){
		var rs=Ext.ListView.superclass.collectData.apply(this,arguments);
		return{
			columns:this.columns,
			rows:rs
		}
	},
	verifyInternalSize:function(){
		if(this.lastSize){
			this.onResize(this.lastSize.width,this.lastSize.height);
		}
	},
	onResize:function(w,h){
		var bd=this.innerBody.dom;
		var hd=this.innerHd.dom
		if(!bd){
			return;
		}
		var bdp=bd.parentNode;
		if(Ext.isNumber(w)){
			var sw=w-this.scrollOffset;
			if(this.reserveScrollOffset||((bdp.offsetWidth-bdp.clientWidth)>10)){
				bd.style.width=sw+'px';
				hd.style.width=sw+'px';
			}else{
				bd.style.width=w+'px';
				hd.style.width=w+'px';
				setTimeout(function(){
					if((bdp.offsetWidth-bdp.clientWidth)>10){
						bd.style.width=sw+'px';
						hd.style.width=sw+'px';
					}
				},10);
			}
		}
		if(Ext.isNumber(h=='number')){
			bdp.style.height=(h-hd.parentNode.offsetHeight)+'px';
		}
	},
	updateIndexes:function(){
		Ext.ListView.superclass.updateIndexes.apply(this,arguments);
		this.verifyInternalSize();
	},
	findHeaderIndex:function(hd){
		hd=hd.dom||hd;
		var pn=hd.parentNode,cs=pn.parentNode.childNodes;
		for(var i=0,c;c=cs[i];i++){
			if(c==pn){
				return i;
			}
		}
		return-1;
	},
	setHdWidths:function(){
		var els=this.innerHd.dom.getElementsByTagName('div');
		for(var i=0,cs=this.columns,len=cs.length;i<len;i++){
			els[i].style.width=cs[i].width+'%';
		}
	}});
Ext.reg('listview',Ext.ListView);
Ext.ListView.ColumnResizer=Ext.extend(Ext.util.Observable,{
	minPct:.05,
	constructor:function(config){
		Ext.apply(this,config);
		Ext.ListView.ColumnResizer.superclass.constructor.call(this);
	},
	init:function(listView){
		this.view=listView;
		listView.on('render',this.initEvents,this);
	},
	initEvents:function(view){
		view.mon(view.innerHd,'mousemove',this.handleHdMove,this);
		this.tracker=new Ext.dd.DragTracker({
			onBeforeStart:this.onBeforeStart.createDelegate(this),
			onStart:this.onStart.createDelegate(this),
			onDrag:this.onDrag.createDelegate(this),
			onEnd:this.onEnd.createDelegate(this),
			tolerance:3,
			autoStart:300
		});
		this.tracker.initEl(view.innerHd);
		view.on('beforedestroy',this.tracker.destroy,this.tracker);
	},
	handleHdMove:function(e,t){
		var hw=5;
		var x=e.getPageX();
		var hd=e.getTarget('em',3,true);
		if(hd){
			var r=hd.getRegion();
			var ss=hd.dom.style;
			var pn=hd.dom.parentNode;
			if(x-r.left<=hw&&pn!=pn.parentNode.firstChild){
				this.activeHd=Ext.get(pn.previousSibling.firstChild);
				ss.cursor=Ext.isWebKit?'e-resize':'col-resize';
			}else if(r.right-x<=hw&&pn!=pn.parentNode.lastChild.previousSibling){
				this.activeHd=hd;
				ss.cursor=Ext.isWebKit?'w-resize':'col-resize';
			}else{
				delete this.activeHd;
				ss.cursor='';
			}
		}
	},
	onBeforeStart:function(e){
		this.dragHd=this.activeHd;
		return!!this.dragHd;
	},
	onStart:function(e){
		this.view.disableHeaders=true;
		this.proxy=this.view.el.createChild({cls:'x-list-resizer'});
		this.proxy.setHeight(this.view.el.getHeight());
		var x=this.tracker.getXY()[0];
		var w=this.view.innerHd.getWidth();
		this.hdX=this.dragHd.getX();
		this.hdIndex=this.view.findHeaderIndex(this.dragHd);
		this.proxy.setX(this.hdX);
		this.proxy.setWidth(x-this.hdX);
		this.minWidth=w*this.minPct;
		this.maxWidth=w-(this.minWidth*(this.view.columns.length-1-this.hdIndex));
	},
	onDrag:function(e){
		var cursorX=this.tracker.getXY()[0];
		this.proxy.setWidth((cursorX-this.hdX).constrain(this.minWidth,this.maxWidth));
	},
	onEnd:function(e){
		var nw=this.proxy.getWidth();
		this.proxy.remove();
		var index=this.hdIndex;
		var vw=this.view,cs=vw.columns,len=cs.length;
		var w=this.view.innerHd.getWidth(),minPct=this.minPct*100;
		var pct=Math.ceil((nw*100)/w);
		var diff=cs[index].width-pct;
		var each=Math.floor(diff/(len-1-index));
		var mod=diff-(each*(len-1-index));
		for(var i=index+1;i<len;i++){
			var cw=cs[i].width+each;
			var ncw=Math.max(minPct,cw);
			if(cw!=ncw){
				mod+=cw-ncw;
			}
			cs[i].width=ncw;
		}
		cs[index].width=pct;
		cs[index+1].width+=mod;
		delete this.dragHd;
		this.view.setHdWidths();
		this.view.refresh();
		setTimeout(function(){
			vw.disableHeaders=false;
		},100);
	}});
Ext.ListView.Sorter=Ext.extend(Ext.util.Observable,{
	sortClasses:["sort-asc","sort-desc"],
	constructor:function(config){
		Ext.apply(this,config);
		Ext.ListView.Sorter.superclass.constructor.call(this);
	},
	init:function(listView){
		this.view=listView;
		listView.on('render',this.initEvents,this);
	},
	initEvents:function(view){
		view.mon(view.innerHd,'click',this.onHdClick,this);
		view.innerHd.setStyle('cursor','pointer');
		view.mon(view.store,'datachanged',this.updateSortState,this);
		this.updateSortState.defer(10,this,[view.store]);
	},
	updateSortState:function(store){
		var state=store.getSortState();
		if(!state){
			return;
		}
		this.sortState=state;
		var cs=this.view.columns,sortColumn=-1;
		for(var i=0,len=cs.length;i<len;i++){
			if(cs[i].dataIndex==state.field){
				sortColumn=i;
				break;
			}
		}
		if(sortColumn!=-1){
			var sortDir=state.direction;
			this.updateSortIcon(sortColumn,sortDir);
		}
	},
	updateSortIcon:function(col,dir){
		var sc=this.sortClasses;
		var hds=this.view.innerHd.select('em').removeClass(sc);
		hds.item(col).addClass(sc[dir=="DESC"?1:0]);
	},
	onHdClick:function(e){
		var hd=e.getTarget('em',3);
		if(hd&&!this.view.disableHeaders){
			var index=this.view.findHeaderIndex(hd);
			this.view.store.sort(this.view.columns[index].dataIndex);
		}
	}});
Ext.TabPanel=Ext.extend(Ext.Panel,{
	monitorResize:true,
	deferredRender:true,
	tabWidth:120,
	minTabWidth:30,
	resizeTabs:false,
	enableTabScroll:false,
	scrollIncrement:0,
	scrollRepeatInterval:400,
	scrollDuration:0.35,
	animScroll:true,
	tabPosition:'top',
	baseCls:'x-tab-panel',
	autoTabs:false,
	autoTabSelector:'div.x-tab',
	activeTab:null,
	tabMargin:2,
	plain:false,
	wheelIncrement:20,
	idDelimiter:'__',
	itemCls:'x-tab-item',
	elements:'body',
	headerAsText:false,
	frame:false,
	hideBorders:true,
	initComponent:function(){
		this.frame=false;
		Ext.TabPanel.superclass.initComponent.call(this);
		this.addEvents(
			'beforetabchange',
			'tabchange',
			'contextmenu'
		);
		this.setLayout(new Ext.layout.CardLayout(Ext.apply({
			layoutOnCardChange:this.layoutOnTabChange,
			deferredRender:this.deferredRender
		},this.layoutConfig)));
		if(this.tabPosition=='top'){
			this.elements+=',header';
			this.stripTarget='header';
		}else{
			this.elements+=',footer';
			this.stripTarget='footer';
		}
		if(!this.stack){
			this.stack=Ext.TabPanel.AccessStack();
		}
		this.initItems();
	},
	onRender:function(ct,position){
		Ext.TabPanel.superclass.onRender.call(this,ct,position);
		if(this.plain){
			var pos=this.tabPosition=='top'?'header':'footer';
			this[pos].addClass('x-tab-panel-'+pos+'-plain');
		}
		var st=this[this.stripTarget];
		this.stripWrap=st.createChild({cls:'x-tab-strip-wrap',cn:{
			tag:'ul',cls:'x-tab-strip x-tab-strip-'+this.tabPosition}});
		var beforeEl=(this.tabPosition=='bottom'?this.stripWrap:null);
		this.stripSpacer=st.createChild({cls:'x-tab-strip-spacer'},beforeEl);
		this.strip=new Ext.Element(this.stripWrap.dom.firstChild);
		this.edge=this.strip.createChild({tag:'li',cls:'x-tab-edge'});
		this.strip.createChild({cls:'x-clear'});
		this.body.addClass('x-tab-panel-body-'+this.tabPosition);
		if(!this.itemTpl){
			var tt=new Ext.Template(
				'<li class="{cls}" id="{id}"><a class="x-tab-strip-close" onclick="return false;"></a>',
				'<a class="x-tab-right" href="#" onclick="return false;"><em class="x-tab-left">',
				'<span class="x-tab-strip-inner"><span class="x-tab-strip-text {iconCls}">{text}</span></span>',
				'</em></a></li>'
			);
			tt.disableFormats=true;
			tt.compile();
			Ext.TabPanel.prototype.itemTpl=tt;
		}
		this.items.each(this.initTab,this);
	},
	afterRender:function(){
		Ext.TabPanel.superclass.afterRender.call(this);
		if(this.autoTabs){
			this.readTabs(false);
		}
		if(this.activeTab!==undefined){
			var item=Ext.isObject(this.activeTab)?this.activeTab:this.items.get(this.activeTab);
			delete this.activeTab;
			this.setActiveTab(item);
		}
	},
	initEvents:function(){
		Ext.TabPanel.superclass.initEvents.call(this);
		this.on('add',this.onAdd,this,{target:this});
		this.on('remove',this.onRemove,this,{target:this});
		this.mon(this.strip,'mousedown',this.onStripMouseDown,this);
		this.mon(this.strip,'contextmenu',this.onStripContextMenu,this);
		if(this.enableTabScroll){
			this.mon(this.strip,'mousewheel',this.onWheel,this);
		}
	},
	findTargets:function(e){
		var item=null;
		var itemEl=e.getTarget('li',this.strip);
		if(itemEl){
			item=this.getComponent(itemEl.id.split(this.idDelimiter)[1]);
			if(item.disabled){
				return{
					close:null,
					item:null,
					el:null
				};
			}
		}
		return{
			close:e.getTarget('.x-tab-strip-close',this.strip),
			item:item,
			el:itemEl
		};
	},
	onStripMouseDown:function(e){
		if(e.button!==0){
			return;
		}
		e.preventDefault();
		var t=this.findTargets(e);
		if(t.close){
			if(t.item.fireEvent('beforeclose',t.item)!==false){
				t.item.fireEvent('close',t.item);
				this.remove(t.item);
			}
			return;
		}
		if(t.item&&t.item!=this.activeTab){
			this.setActiveTab(t.item);
		}
	},
	onStripContextMenu:function(e){
		e.preventDefault();
		var t=this.findTargets(e);
		if(t.item){
			this.fireEvent('contextmenu',this,t.item,e);
		}
	},
	readTabs:function(removeExisting){
		if(removeExisting===true){
			this.items.each(function(item){
				this.remove(item);
			},this);
		}
		var tabs=this.el.query(this.autoTabSelector);
		for(var i=0,len=tabs.length;i<len;i++){
			var tab=tabs[i];
			var title=tab.getAttribute('title');
			tab.removeAttribute('title');
			this.add({
				title:title,
				contentEl:tab
			});
		}
	},
	initTab:function(item,index){
		var before=this.strip.dom.childNodes[index];
		var p=this.getTemplateArgs(item);
		var el=before?
				 this.itemTpl.insertBefore(before,p):
				 this.itemTpl.append(this.strip,p);
		Ext.fly(el).addClassOnOver('x-tab-strip-over');
		if(item.tabTip){
			Ext.fly(el).child('span.x-tab-strip-text',true).qtip=item.tabTip;
		}
		item.tabEl=el;
		item.on('disable',this.onItemDisabled,this);
		item.on('enable',this.onItemEnabled,this);
		item.on('titlechange',this.onItemTitleChanged,this);
		item.on('iconchange',this.onItemIconChanged,this);
		item.on('beforeshow',this.onBeforeShowItem,this);
	},
	getTemplateArgs:function(item){
		var cls=item.closable?'x-tab-strip-closable':'';
		if(item.disabled){
			cls+=' x-item-disabled';
		}
		if(item.iconCls){
			cls+=' x-tab-with-icon';
		}
		if(item.tabCls){
			cls+=' '+item.tabCls;
		}
		return{
			id:this.id+this.idDelimiter+item.getItemId(),
			text:item.title,
			cls:cls,
			iconCls:item.iconCls||''
		};
	},
	onAdd:function(tp,item,index){
		this.initTab(item,index);
		if(this.items.getCount()==1){
			this.syncSize();
		}
		this.delegateUpdates();
	},
	onBeforeAdd:function(item){
		var existing=item.events?(this.items.containsKey(item.getItemId())?item:null):this.items.get(item);
		if(existing){
			this.setActiveTab(item);
			return false;
		}
		Ext.TabPanel.superclass.onBeforeAdd.apply(this,arguments);
		var es=item.elements;
		item.elements=es?es.replace(',header',''):es;
		item.border=(item.border===true);
	},
	onRemove:function(tp,item){
		Ext.destroy(Ext.get(this.getTabEl(item)));
		this.stack.remove(item);
		item.un('disable',this.onItemDisabled,this);
		item.un('enable',this.onItemEnabled,this);
		item.un('titlechange',this.onItemTitleChanged,this);
		item.un('iconchange',this.onItemIconChanged,this);
		item.un('beforeshow',this.onBeforeShowItem,this);
		if(item==this.activeTab){
			var next=this.stack.next();
			if(next){
				this.setActiveTab(next);
			}else if(this.items.getCount()>0){
				this.setActiveTab(0);
			}else{
				this.activeTab=null;
			}
		}
		this.delegateUpdates();
	},
	onBeforeShowItem:function(item){
		if(item!=this.activeTab){
			this.setActiveTab(item);
			return false;
		}
	},
	onItemDisabled:function(item){
		var el=this.getTabEl(item);
		if(el){
			Ext.fly(el).addClass('x-item-disabled');
		}
		this.stack.remove(item);
	},
	onItemEnabled:function(item){
		var el=this.getTabEl(item);
		if(el){
			Ext.fly(el).removeClass('x-item-disabled');
		}
	},
	onItemTitleChanged:function(item){
		var el=this.getTabEl(item);
		if(el){
			Ext.fly(el).child('span.x-tab-strip-text',true).innerHTML=item.title;
		}
	},
	onItemIconChanged:function(item,iconCls,oldCls){
		var el=this.getTabEl(item);
		if(el){
			Ext.fly(el).child('span.x-tab-strip-text').replaceClass(oldCls,iconCls);
		}
	},
	getTabEl:function(item){
		return document.getElementById(this.id+this.idDelimiter+this.getComponent(item).getItemId());
	},
	onResize:function(){
		Ext.TabPanel.superclass.onResize.apply(this,arguments);
		this.delegateUpdates();
	},
	beginUpdate:function(){
		this.suspendUpdates=true;
	},
	endUpdate:function(){
		this.suspendUpdates=false;
		this.delegateUpdates();
	},
	hideTabStripItem:function(item){
		item=this.getComponent(item);
		var el=this.getTabEl(item);
		if(el){
			el.style.display='none';
			this.delegateUpdates();
		}
		this.stack.remove(item);
	},
	unhideTabStripItem:function(item){
		item=this.getComponent(item);
		var el=this.getTabEl(item);
		if(el){
			el.style.display='';
			this.delegateUpdates();
		}
	},
	delegateUpdates:function(){
		if(this.suspendUpdates){
			return;
		}
		if(this.resizeTabs&&this.rendered){
			this.autoSizeTabs();
		}
		if(this.enableTabScroll&&this.rendered){
			this.autoScrollTabs();
		}
	},
	autoSizeTabs:function(){
		var count=this.items.length;
		var ce=this.tabPosition!='bottom'?'header':'footer';
		var ow=this[ce].dom.offsetWidth;
		var aw=this[ce].dom.clientWidth;
		if(!this.resizeTabs||count<1||!aw){
			return;
		}
		var each=Math.max(Math.min(Math.floor((aw-4)/count)-this.tabMargin,this.tabWidth),this.minTabWidth);
		this.lastTabWidth=each;
		var lis=this.strip.query("li:not([className^=x-tab-edge])");
		for(var i=0,len=lis.length;i<len;i++){
			var li=lis[i];
			var inner=Ext.fly(li).child('.x-tab-strip-inner',true);
			var tw=li.offsetWidth;
			var iw=inner.offsetWidth;
			inner.style.width=(each-(tw-iw))+'px';
		}
	},
	adjustBodyWidth:function(w){
		if(this.header){
			this.header.setWidth(w);
		}
		if(this.footer){
			this.footer.setWidth(w);
		}
		return w;
	},
	setActiveTab:function(item){
		item=this.getComponent(item);
		if(!item||this.fireEvent('beforetabchange',this,item,this.activeTab)===false){
			return;
		}
		if(!this.rendered){
			this.activeTab=item;
			return;
		}
		if(this.activeTab!=item){
			if(this.activeTab){
				var oldEl=this.getTabEl(this.activeTab);
				if(oldEl){
					Ext.fly(oldEl).removeClass('x-tab-strip-active');
				}
				this.activeTab.fireEvent('deactivate',this.activeTab);
			}
			var el=this.getTabEl(item);
			Ext.fly(el).addClass('x-tab-strip-active');
			this.activeTab=item;
			this.stack.add(item);
			this.layout.setActiveItem(item);
			if(this.scrolling){
				this.scrollToTab(item,this.animScroll);
			}
			item.fireEvent('activate',item);
			this.fireEvent('tabchange',this,item);
		}
	},
	getActiveTab:function(){
		return this.activeTab||null;
	},
	getItem:function(item){
		return this.getComponent(item);
	},
	autoScrollTabs:function(){
		this.pos=this.tabPosition=='bottom'?this.footer:this.header;
		var count=this.items.length;
		var ow=this.pos.dom.offsetWidth;
		var tw=this.pos.dom.clientWidth;
		var wrap=this.stripWrap;
		var wd=wrap.dom;
		var cw=wd.offsetWidth;
		var pos=this.getScrollPos();
		var l=this.edge.getOffsetsTo(this.stripWrap)[0]+pos;
		if(!this.enableTabScroll||count<1||cw<20){
			return;
		}
		if(l<=tw){
			wd.scrollLeft=0;
			wrap.setWidth(tw);
			if(this.scrolling){
				this.scrolling=false;
				this.pos.removeClass('x-tab-scrolling');
				this.scrollLeft.hide();
				this.scrollRight.hide();
				if(Ext.isAir||Ext.isWebKit){
					wd.style.marginLeft='';
					wd.style.marginRight='';
				}
			}
		}else{
			if(!this.scrolling){
				this.pos.addClass('x-tab-scrolling');
				if(Ext.isAir||Ext.isWebKit){
					wd.style.marginLeft='18px';
					wd.style.marginRight='18px';
				}
			}
			tw-=wrap.getMargins('lr');
			wrap.setWidth(tw>20?tw:20);
			if(!this.scrolling){
				if(!this.scrollLeft){
					this.createScrollers();
				}else{
					this.scrollLeft.show();
					this.scrollRight.show();
				}
			}
			this.scrolling=true;
			if(pos>(l-tw)){
				wd.scrollLeft=l-tw;
			}else{
				this.scrollToTab(this.activeTab,false);
			}
			this.updateScrollButtons();
		}
	},
	createScrollers:function(){
		this.pos.addClass('x-tab-scrolling-'+this.tabPosition);
		var h=this.stripWrap.dom.offsetHeight;
		var sl=this.pos.insertFirst({
			cls:'x-tab-scroller-left'
		});
		sl.setHeight(h);
		sl.addClassOnOver('x-tab-scroller-left-over');
		this.leftRepeater=new Ext.util.ClickRepeater(sl,{
			interval:this.scrollRepeatInterval,
			handler:this.onScrollLeft,
			scope:this
		});
		this.scrollLeft=sl;
		var sr=this.pos.insertFirst({
			cls:'x-tab-scroller-right'
		});
		sr.setHeight(h);
		sr.addClassOnOver('x-tab-scroller-right-over');
		this.rightRepeater=new Ext.util.ClickRepeater(sr,{
			interval:this.scrollRepeatInterval,
			handler:this.onScrollRight,
			scope:this
		});
		this.scrollRight=sr;
	},
	getScrollWidth:function(){
		return this.edge.getOffsetsTo(this.stripWrap)[0]+this.getScrollPos();
	},
	getScrollPos:function(){
		return parseInt(this.stripWrap.dom.scrollLeft,10)||0;
	},
	getScrollArea:function(){
		return parseInt(this.stripWrap.dom.clientWidth,10)||0;
	},
	getScrollAnim:function(){
		return{duration:this.scrollDuration,callback:this.updateScrollButtons,scope:this};
	},
	getScrollIncrement:function(){
		return this.scrollIncrement||(this.resizeTabs?this.lastTabWidth+2:100);
	},
	scrollToTab:function(item,animate){
		if(!item){return;}
		var el=this.getTabEl(item);
		var pos=this.getScrollPos(),area=this.getScrollArea();
		var left=Ext.fly(el).getOffsetsTo(this.stripWrap)[0]+pos;
		var right=left+el.offsetWidth;
		if(left<pos){
			this.scrollTo(left,animate);
		}else if(right>(pos+area)){
			this.scrollTo(right-area,animate);
		}
	},
	scrollTo:function(pos,animate){
		this.stripWrap.scrollTo('left',pos,animate?this.getScrollAnim():false);
		if(!animate){
			this.updateScrollButtons();
		}
	},
	onWheel:function(e){
		var d=e.getWheelDelta()*this.wheelIncrement*-1;
		e.stopEvent();
		var pos=this.getScrollPos();
		var newpos=pos+d;
		var sw=this.getScrollWidth()-this.getScrollArea();
		var s=Math.max(0,Math.min(sw,newpos));
		if(s!=pos){
			this.scrollTo(s,false);
		}
	},
	onScrollRight:function(){
		var sw=this.getScrollWidth()-this.getScrollArea();
		var pos=this.getScrollPos();
		var s=Math.min(sw,pos+this.getScrollIncrement());
		if(s!=pos){
			this.scrollTo(s,this.animScroll);
		}
	},
	onScrollLeft:function(){
		var pos=this.getScrollPos();
		var s=Math.max(0,pos-this.getScrollIncrement());
		if(s!=pos){
			this.scrollTo(s,this.animScroll);
		}
	},
	updateScrollButtons:function(){
		var pos=this.getScrollPos();
		this.scrollLeft[pos===0?'addClass':'removeClass']('x-tab-scroller-left-disabled');
		this.scrollRight[pos>=(this.getScrollWidth()-this.getScrollArea())?'addClass':'removeClass']('x-tab-scroller-right-disabled');
	},
	beforeDestroy:function(){
		if(this.items){
			this.items.each(function(item){
				if(item&&item.tabEl){
					Ext.get(item.tabEl).removeAllListeners();
					item.tabEl=null;
				}
			},this);
		}
		if(this.strip){
			this.strip.removeAllListeners();
		}
		Ext.TabPanel.superclass.beforeDestroy.apply(this);
	}
	});
Ext.reg('tabpanel',Ext.TabPanel);
Ext.TabPanel.prototype.activate=Ext.TabPanel.prototype.setActiveTab;
Ext.TabPanel.AccessStack=function(){
	var items=[];
	return{
		add:function(item){
			items.push(item);
			if(items.length>10){
				items.shift();
			}
		},
		remove:function(item){
			var s=[];
			for(var i=0,len=items.length;i<len;i++){
				if(items[i]!=item){
					s.push(items[i]);
				}
			}
			items=s;
		},
		next:function(){
			return items.pop();
		}
	};};
Ext.Button=Ext.extend(Ext.BoxComponent,{
	hidden:false,
	disabled:false,
	pressed:false,
	enableToggle:false,
	menuAlign:'tl-bl?',
	type:'button',
	menuClassTarget:'tr:nth(2)',
	clickEvent:'click',
	handleMouseEvents:true,
	tooltipType:'qtip',
	buttonSelector:'button:first-child',
	scale:'small',
	iconAlign:'left',
	arrowAlign:'right',
	initComponent:function(){
		Ext.Button.superclass.initComponent.call(this);
		this.addEvents(
			'click',
			'toggle',
			'mouseover',
			'mouseout',
			'menushow',
			'menuhide',
			'menutriggerover',
			'menutriggerout'
		);
		if(this.menu){
			this.menu=Ext.menu.MenuMgr.get(this.menu);
		}
		if(Ext.isString(this.toggleGroup)){
			this.enableToggle=true;
		}
	},
	getTemplateArgs:function(){
		var cls=(this.cls||'');
		cls+=(this.iconCls||this.icon)?(this.text?' x-btn-text-icon':' x-btn-icon'):' x-btn-noicon';
		if(this.pressed){
			cls+=' x-btn-pressed';
		}
		return[this.text||'&#160;',this.type,this.iconCls||'',cls,'x-btn-'+this.scale+' x-btn-icon-'+this.scale+'-'+this.iconAlign,this.getMenuClass()];
	},
	getMenuClass:function(){
		return this.menu?(this.arrowAlign!='bottom'?'x-btn-arrow':'x-btn-arrow-bottom'):'';
	},
	onRender:function(ct,position){
		if(!this.template){
			if(!Ext.Button.buttonTemplate){
				Ext.Button.buttonTemplate=new Ext.Template(
					'<table cellspacing="0" class="x-btn {3}"><tbody class="{4}">',
					'<tr><td class="x-btn-tl"><i>&#160;</i></td><td class="x-btn-tc"></td><td class="x-btn-tr"><i>&#160;</i></td></tr>',
					'<tr><td class="x-btn-ml"><i>&#160;</i></td><td class="x-btn-mc"><em class="{5}" unselectable="on"><button class="x-btn-text {2}" type="{1}">{0}</button></em></td><td class="x-btn-mr"><i>&#160;</i></td></tr>',
					'<tr><td class="x-btn-bl"><i>&#160;</i></td><td class="x-btn-bc"></td><td class="x-btn-br"><i>&#160;</i></td></tr>',
					"</tbody></table>");
				Ext.Button.buttonTemplate.compile();
			}
			this.template=Ext.Button.buttonTemplate;
		}
		var btn,targs=this.getTemplateArgs();
		if(position){
			btn=this.template.insertBefore(position,targs,true);
		}else{
			btn=this.template.append(ct,targs,true);
		}
		this.btnEl=btn.child(this.buttonSelector);
		this.mon(this.btnEl,{
			scope:this,
			focus:this.onFocus,
			blur:this.onBlur
		});
		this.initButtonEl(btn,this.btnEl);
		Ext.ButtonToggleMgr.register(this);
	},
	initButtonEl:function(btn,btnEl){
		this.el=btn;
		if(this.id){
			this.el.dom.id=this.el.id=this.id;
		}
		if(this.icon){
			btnEl.setStyle('background-image','url('+this.icon+')');
		}
		if(this.tabIndex!==undefined){
			btnEl.dom.tabIndex=this.tabIndex;
		}
		if(this.tooltip){
			this.setTooltip(this.tooltip,true);
		}
		if(this.handleMouseEvents){
			this.mon(btn,{
				scope:this,
				mouseover:this.onMouseOver,
				mousedown:this.onMouseDown
			});
		}
		if(this.menu){
			this.mon(this.menu,{
				scope:this,
				show:this.onMenuShow,
				hide:this.onMenuHide
			});
		}
		if(this.repeat){
			var repeater=new Ext.util.ClickRepeater(btn,Ext.isObject(this.repeat)?this.repeat:{});
			this.mon(repeater,'click',this.onClick,this);
		}
		this.mon(btn,this.clickEvent,this.onClick,this);
	},
	afterRender:function(){
		Ext.Button.superclass.afterRender.call(this);
		this.doAutoWidth();
	},
	setIconClass:function(cls){
		if(this.el){
			this.btnEl.replaceClass(this.iconCls,cls);
		}
		this.iconCls=cls;
		return this;
	},
	setTooltip:function(tooltip,initial){
		if(this.rendered){
			if(!initial){
				this.clearTip();
			}
			if(Ext.isObject(tooltip)){
				Ext.QuickTips.register(Ext.apply({
					 target:this.btnEl.id
				},tooltip));
				this.tooltip=tooltip;
			}else{
				this.btnEl.dom[this.tooltipType]=tooltip;
			}
		}else{
			this.tooltip=tooltip;
		}
		return this;
	},
	clearTip:function(){
		if(Ext.isObject(this.tooltip)){
			Ext.QuickTips.unregister(this.btnEl);
		}
	},
	beforeDestroy:function(){
		if(this.rendered){
			this.clearTip();
		}
		Ext.destroy(this.menu,this.repeater);
	},
	onDestroy:function(){
		var doc=Ext.getDoc();
		doc.un('mouseover',this.monitorMouseOver,this);
		doc.un('mouseup',this.onMouseUp,this);
		if(this.rendered){
			Ext.ButtonToggleMgr.unregister(this);
		}
	},
	doAutoWidth:function(){
		if(this.el&&this.text&&this.width===undefined){
			this.el.setWidth('auto');
			if(Ext.isIE7&&Ext.isStrict){
				var ib=this.btnEl;
				if(ib&&ib.getWidth()>20){
					ib.clip();
					ib.setWidth(Ext.util.TextMetrics.measure(ib,this.text).width+ib.getFrameWidth('lr'));
				}
			}
			if(this.minWidth){
				if(this.el.getWidth()<this.minWidth){
					this.el.setWidth(this.minWidth);
				}
			}
		}
	},
	setHandler:function(handler,scope){
		this.handler=handler;
		this.scope=scope;
		return this;
	},
	setText:function(text){
		this.text=text;
		if(this.el){
			this.el.child('td.x-btn-mc '+this.buttonSelector).update(text);
		}
		this.doAutoWidth();
		return this;
	},
	getText:function(){
		return this.text;
	},
	toggle:function(state,suppressEvent){
		state=state===undefined?!this.pressed:!!state;
		if(state!=this.pressed){
			this.el[state?'addClass':'removeClass']('x-btn-pressed');
			this.pressed=state;
			if(!suppressEvent){
				this.fireEvent('toggle',this,state);
				if(this.toggleHandler){
					this.toggleHandler.call(this.scope||this,this,state);
				}
			}
		}
		return this;
	},
	focus:function(){
		this.btnEl.focus();
	},
	onDisable:function(){
		this.onDisableChange(true);
	},
	onEnable:function(){
		this.onDisableChange(false);
	},
	onDisableChange:function(disabled){
		if(this.el){
			if(!Ext.isIE6||!this.text){
				this.el[disabled?'addClass':'removeClass'](this.disabledClass);
			}
			this.el.dom.disabled=disabled;
		}
		this.disabled=disabled;
	},
	showMenu:function(){
		if(this.rendered&&this.menu){
			if(this.tooltip){
				Ext.QuickTips.getQuickTip().cancelShow(this.btnEl);
			}
			this.menu.show(this.el,this.menuAlign);
		}
		return this;
	},
	hideMenu:function(){
		if(this.menu){
			this.menu.hide();
		}
		return this;
	},
	hasVisibleMenu:function(){
		return this.menu&&this.menu.isVisible();
	},
	onClick:function(e){
		if(e){
			e.preventDefault();
		}
		if(e.button!==0){
			return;
		}
		if(!this.disabled){
			if(this.enableToggle&&(this.allowDepress!==false||!this.pressed)){
				this.toggle();
			}
			if(this.menu&&!this.menu.isVisible()&&!this.ignoreNextClick){
				this.showMenu();
			}
			this.fireEvent('click',this,e);
			if(this.handler){
				this.handler.call(this.scope||this,this,e);
			}
		}
	},
	isMenuTriggerOver:function(e,internal){
		return this.menu&&!internal;
	},
	isMenuTriggerOut:function(e,internal){
		return this.menu&&!internal;
	},
	onMouseOver:function(e){
		if(!this.disabled){
			var internal=e.within(this.el,true);
			if(!internal){
				this.el.addClass('x-btn-over');
				if(!this.monitoringMouseOver){
					Ext.getDoc().on('mouseover',this.monitorMouseOver,this);
					this.monitoringMouseOver=true;
				}
				this.fireEvent('mouseover',this,e);
			}
			if(this.isMenuTriggerOver(e,internal)){
				this.fireEvent('menutriggerover',this,this.menu,e);
			}
		}
	},
	monitorMouseOver:function(e){
		if(e.target!=this.el.dom&&!e.within(this.el)){
			if(this.monitoringMouseOver){
				Ext.getDoc().un('mouseover',this.monitorMouseOver,this);
				this.monitoringMouseOver=false;
			}
			this.onMouseOut(e);
		}
	},
	onMouseOut:function(e){
		var internal=e.within(this.el)&&e.target!=this.el.dom;
		this.el.removeClass('x-btn-over');
		this.fireEvent('mouseout',this,e);
		if(this.isMenuTriggerOut(e,internal)){
			this.fireEvent('menutriggerout',this,this.menu,e);
		}
	},
	onFocus:function(e){
		if(!this.disabled){
			this.el.addClass('x-btn-focus');
		}
	},
	onBlur:function(e){
		this.el.removeClass('x-btn-focus');
	},
	getClickEl:function(e,isUp){
	 return this.el;
	},
	onMouseDown:function(e){
		if(!this.disabled&&e.button===0){
			this.getClickEl(e).addClass('x-btn-click');
			Ext.getDoc().on('mouseup',this.onMouseUp,this);
		}
	},
	onMouseUp:function(e){
		if(e.button===0){
			this.getClickEl(e,true).removeClass('x-btn-click');
			Ext.getDoc().un('mouseup',this.onMouseUp,this);
		}
	},
	onMenuShow:function(e){
		this.ignoreNextClick=0;
		this.el.addClass('x-btn-menu-active');
		this.fireEvent('menushow',this,this.menu);
	},
	onMenuHide:function(e){
		this.el.removeClass('x-btn-menu-active');
		this.ignoreNextClick=this.restoreClick.defer(250,this);
		this.fireEvent('menuhide',this,this.menu);
	},
	restoreClick:function(){
		this.ignoreNextClick=0;
	}
	});
Ext.reg('button',Ext.Button);
Ext.ButtonToggleMgr=function(){
var groups={};
function toggleGroup(btn,state){
	 if(state){
		 var g=groups[btn.toggleGroup];
		 for(var i=0,l=g.length;i<l;i++){
			 if(g[i]!=btn){
				 g[i].toggle(false);
			}
		}
	}}
return{
	 register:function(btn){
		 if(!btn.toggleGroup){
			 return;
		}
		 var g=groups[btn.toggleGroup];
		 if(!g){
			 g=groups[btn.toggleGroup]=[];
		}
		 g.push(btn);
		 btn.on('toggle',toggleGroup);
	},
	 unregister:function(btn){
		 if(!btn.toggleGroup){
			 return;
		}
		 var g=groups[btn.toggleGroup];
		 if(g){
			 g.remove(btn);
			 btn.un('toggle',toggleGroup);
		}
	},
	 getPressed:function(group){
		 var g=groups[group];
		 if(g){
			 for(var i=0,len=g.length;i<len;i++){
				 if(g[i].pressed===true){
					 return g[i];
				}
			}
		}
		 return null;
	}};}();